---
title: "Exploiting a Major Blunder to Study Policy Accountability: Trump and His Covid Stance in 2020"
author:
- "Eric Guntermann^[Travers Department of Political Science, University
    of California, Berkeley. 210 Social Science Building, Berkeley, CA 94720-1950]"
- "Gabriel S. Lenz^[glenz@berkeley.edu. Travers Department of Political Science, University
    of California, Berkeley. 210 Social Science Building, Berkeley, CA 94720-1950]"

date: "`r format(Sys.time(), '%B %d, %Y')`"
output:
  bookdown::pdf_document2:
    keep_tex: true
    fig_caption: yes
    toc: no
    indent: True
    extra_dependencies: ["subfig","float","setspace","etoc"]
    header-includes:
      - \usepackage{subfig}\usepackage{makecell}
      - \renewcommand{\beginsupplement}{\setcounter{table}{0} \renewcommand{\thetable}{OA\arabic{table}} \renewcommand{\thefigure}{OA\arabic{figure}}\setcounter{figure}{0} \renewcommand{\thesection}{OA} \setcounter{page}{1}} 
      - \setcounter{figure}{0} 
      - \usepackage{caption}
      - \captionsetup[figure]{font=scriptsize}
      - \usepackage{threeparttable}
      - \usepackage{siunitx}
      - \pagenumbering{booktabs} # 
      - \pagenumbering{gobble} # 
biblio-style: apsr
fontsize: 12pt
geometry: margin=1in
bibliography: learning.bib
abstract: "Most theories of democracy assume that voters punish politicians who pursue unpopular policies. Empirical evidence supporting this claim remains elusive, partly because politicians strategically avoid adopting unpopular stances. The 2020 U.S. presidential election offers a unique opportunity to investigate this phenomenon. Incumbent President Donald Trump publicly embraced unpopular positions on Covid-19, arguably the campaign's most critical issue. Using panel survey data, we find many Trump supporters disagreed with his Covid-19 stances and preferred more aggressive government action, yet most remained unaware that his policies conflicted with their views even by the campaign's end. Among those who recognized this contradiction, few defected; instead, many followed Trump, adjusting their own views to match his positions. Although our statistical power to detect voter defections is limited—precisely because learning about his stance was uncommon—Trump's unpopular positions may still have been decisive given the narrow election margin. Broadly, voters' failure to perceive or acknowledge conflicts between their policy views and those of favored candidates constrains their ability to hold politicians accountable, highlighting a critical challenge for democratic accountability."
---
Word count: 9535 (exception granted)


**Statements and Declarations**

The authors acknowledge helpful feedback from Rune Slothuus, attendees of the Lenz-Broockman lab, and participants in the panels "How Campaigns Shape Voters" at the 2021 American Political Science Association Annual Meeting and  "On Misinformation" at the 2022 Midwest Political Science Association Conference. The study was approved by the UC Berkeley Committee for Protection of Human Subjects and performed in accordance with APSA guidelines on ethical standards. All participants provided informed consent. These studies were funded only through the corresponding author's research funds. The authors have no relevant financial or non-financial interests to disclose. Code and data to replicate all the figures, tables, and appendices are available from https://doi.org/10.7910/DVN/WXT2TV.

Key words: Voting behavior; Policy voting; Accountability; Covid-19 


\doublespacing \newpage \setlength\parindent{24pt}

```{r setup, include=FALSE,message=FALSE,warning=FALSE}
rm(list = ls())
library(tidyverse)
library(rmarkdown)
library(bookdown)
library(reshape2)
library(kableExtra)
library(janitor)
library(ggrepel)
library(multcomp)
library(ggallin)
library(stargazer)
library(glmnet)
library(gridExtra)
library(grid)
library(ltm)
library(float)
library(readstata13)
library(yarrr)
library(english)
library(modelsummary)
knitr::opts_chunk$set(echo = FALSE)
knitr::opts_chunk$set(warning = FALSE, message = FALSE) 
knitr::opts_chunk$set(fig.pos = "H", out.extra = "")
options(tinytex.verbose = TRUE)

# Run code to clean and merge pre-election and post-election surveys.
# This code uses Respondent's survey ID, and so isn't run for privacy reasons.
# But we've made the code available.
# Respondent survey ID has been deleted from the raw survey data files.
#  source("cleandata_pre.R")
#  source("cleandata_post.R")
#  source("mergeprepost.R")

#load data
load("Data/Cleaned/panel.Rda")


# Get proportions who ended up voting for each major candidate
Trump_p<-round(sum(dat$vote_post=="Trump",na.rm=T)/sum(dat$vote_post=="Trump"|dat$vote_post=="Biden"|dat$vote_post=="Other",na.rm=T),2)*100
Biden_p<-round(sum(dat$vote_post=="Biden",na.rm=T)/sum(dat$vote_post=="Trump"|dat$vote_post=="Biden"|dat$vote_post=="Other",na.rm=T),2)*100

# Create Trump vote dummies pre/post
dat$vote_trump_pre<-ifelse(dat$vote_pre=="Trump",1,0)
dat$vote_trump_pre[is.na(dat$vote_pre)] <- 0
dat$vote_trump_post<-ifelse(dat$vote_post=="Trump",1,0)
dat$vote_trump_post[is.na(dat$vote_post)] <- 0


# Create a variable in dat called vote_trump_postp5 that is coded 1 if they voted for Trump, 0 if they voted for Biden, and 0.5 if they voted for 'Other' or 'No response'
dat$vote_trump_postp5[dat$vote_post=="Other"] <- 0.5
dat$vote_trump_postp5[dat$vote_post=="No response"] <- 0.5
dat$vote_trump_postp5[dat$vote_post=="Trump"] <- 1
dat$vote_trump_postp5[dat$vote_post=="Biden"] <- 0
table(dat$vote_post)
table(dat$vote_trump_postp5)

dat$vote_trump_prep5[dat$vote_pre=="Other"] <- 0.5
dat$vote_trump_prep5[dat$vote_pre=="No vote"] <- 0.5
dat$vote_trump_prep5[dat$vote_pre=="Trump"] <- 1
dat$vote_trump_prep5[dat$vote_pre=="Biden"] <- 0
table(dat$vote_pre)
table(dat$vote_trump_prep5)


# Combine post turnout with vote choice
dat$vote_post_tot <- as.character(dat$vote_post)
dat$vote_post_tot[dat$voted_post %in% c("I did not vote","I thought about voting this time, but didn't","I usually vote, but didn't this time")] <- "No vote"
dat$vote_post_tot <- as.factor(dat$vote_post_tot)

# Create punished_vote dummy
dat$punished_vote <-ifelse(dat$vote_trump_pre==1 &dat$vote_post_tot!="Trump",1,0)

# Rescale Trump-biden rating difference from 0 to 1
dat$trumpbiden_pre <- (dat$trumpbiden_pre+6)/12
dat$trumpbiden_post <- (dat$trumpbiden_post+6)/12

# Create ratings change variable
dat$trumpbiden_change <- dat$trumpbiden_post - dat$trumpbiden_pre

# Punishment variable ratings (coded for Trump)
dat$punished <- NA
dat$punished[which(dat$trumpbiden_change<0)] <- "Punished"
dat$punished[which(dat$trumpbiden_change>0)] <- "Rewarded"
dat$punished[which(dat$trumpbiden_change==0)] <- "No Change"
dat$punished[which(is.na(dat$trumpbiden_change))] <-"Missing Candidate Ratings"
dat$punished <- as.factor(dat$punished)

# Rescale 7 point party id scale from 0 to 1
dat$pidscale_pre <- (dat$pidscale_pre-1)/6

# Learning variables. These indicate whether Biden and/or Trump placements moved in the right direction
#mandatory masks in public
# Make missing values 2
dat$maskspublic_trump2_pre[is.na(dat$maskspublic_trump2_pre)] <- 2
dat$maskspublic_trump2_post[is.na(dat$maskspublic_trump2_post)] <- 2
dat$maskspublic_biden2_pre[is.na(dat$maskspublic_biden2_pre)] <- 2
dat$maskspublic_biden2_post[is.na(dat$maskspublic_biden2_post)] <- 2


dat$learned_masks <- NA
dat$learned_masks[which(dat$maskspublic_trump2_post>dat$maskspublic_trump2_pre | dat$maskspublic_biden2_post<dat$maskspublic_biden2_pre)] <- "Projected"
dat$learned_masks[which(dat$maskspublic_trump2_post<dat$maskspublic_trump2_pre | dat$maskspublic_biden2_post>dat$maskspublic_biden2_pre)] <- "Learned"
dat$learned_masks[which(dat$maskspublic_trump2_post==dat$maskspublic_trump2_pre & dat$maskspublic_biden2_post==dat$maskspublic_biden2_pre |  # always the same 
                       dat$maskspublic_trump2_post<dat$maskspublic_trump2_pre & dat$maskspublic_biden2_post<dat$maskspublic_biden2_pre | # projected on one, learned on the other
                       dat$maskspublic_biden2_post>dat$maskspublic_biden2_pre & dat$maskspublic_trump2_post>dat$maskspublic_trump2_pre)] <- "Neither"   # projected on one, learned on the other
dat$learned_masks <- as.factor(dat$learned_masks)

#close nonessential businesses
# Make missing values 2
dat$closebusiness_trump2_pre[is.na(dat$closebusiness_trump2_pre)] <- 2
dat$closebusiness_trump2_post[is.na(dat$closebusiness_trump2_post)] <- 2
dat$closebusiness_biden2_pre[is.na(dat$closebusiness_biden2_pre)] <- 2
dat$closebusiness_biden2_post[is.na(dat$closebusiness_biden2_post)] <- 2


dat$learned_closebusiness <- NA
dat$learned_closebusiness[which(dat$closebusiness_trump2_post>dat$closebusiness_trump2_pre | dat$closebusiness_biden2_post<dat$closebusiness_biden2_pre)] <- "Projected"
dat$learned_closebusiness[which(dat$closebusiness_trump2_post<dat$closebusiness_trump2_pre | dat$closebusiness_biden2_post>dat$closebusiness_biden2_pre)] <- "Learned"
dat$learned_closebusiness[which(dat$closebusiness_trump2_post==dat$closebusiness_trump2_pre & dat$closebusiness_biden2_post==dat$closebusiness_biden2_pre |  # always the same 
                       dat$closebusiness_trump2_post>dat$closebusiness_trump2_pre & dat$closebusiness_biden2_post>dat$closebusiness_biden2_pre | # projected on one, learned on the other
                       dat$closebusiness_biden2_post>dat$closebusiness_biden2_pre & dat$closebusiness_trump2_post>dat$closebusiness_trump2_pre)] <- "Neither"  # projected on one, learned on the other # projected and learned
dat$learned_closebusiness <- as.factor(dat$learned_closebusiness)

#WHO membership
# Make missing values 2
dat$who_trump2_pre[is.na(dat$who_trump2_pre)] <- 2
dat$who_trump2_post[is.na(dat$who_trump2_post)] <- 2
dat$who_biden2_pre[is.na(dat$who_biden2_pre)] <- 2
dat$who_biden2_post[is.na(dat$who_biden2_post)] <- 2

dat$learned_who <- NA
dat$learned_who[which(dat$who_trump2_post>dat$who_trump2_pre | dat$who_biden2_post<dat$who_biden2_pre)] <- "Projected"
dat$learned_who[which(dat$who_trump2_post<dat$who_trump2_pre | dat$who_biden2_post>dat$who_biden2_pre)] <- "Learned"
dat$learned_who[which(dat$who_trump2_post==dat$who_trump2_pre & dat$who_biden2_post==dat$who_biden2_pre |  # always the same 
                       dat$who_trump2_post>dat$who_trump2_pre & dat$who_biden2_post>dat$who_biden2_pre | # projected on one, learned on the other
                       dat$who_biden2_post<dat$who_biden2_pre & dat$who_trump2_post<dat$who_trump2_pre)]  <- "Neither" # projected on one, learned on the other
dat$learned_who <- as.factor(dat$learned_who)
dat$learneddum_masks <- ifelse(dat$learned_masks=="Learned",1,0) # Dummy variables for learning whether Biden and/or Trump placements moved in the right direction
dat$learneddum_closebusiness <- ifelse(dat$learned_closebusiness=="Learned",1,0)
dat$learneddum_who <- ifelse(dat$learned_who=="Learned",1,0)
dat$learned_index<-dat$learneddum_masks+dat$learneddum_closebusiness+dat$learneddum_who # create index of learning for the three issues whether Biden and/or Trump placements moved in the right direction

#Learning second measure - relative
dat$learned_index2<-(dat$maskspublic_cand_post-dat$maskspublic_cand_pre)+(dat$closebusiness_cand_post-dat$closebusiness_cand_pre)+
  +(dat$who_cand_post-dat$who_cand_pre)

#A third measure of learning that's based on the calculating the change in the position of the perception of each candidate from time one to two, setting missing values at time one to the mid-value on the three-point scale, so two. It then reverses the Trump measures and takes the average, ignoring missing values. And so provides an overall sense of whether perceptions of the candidates generally drifted in the right direction or wrong direction.
# Define the variables
dat$maskspublic_trump_learn3 <- (dat$maskspublic_trump2_post - ifelse(is.na(dat$maskspublic_trump2_pre), 2, dat$maskspublic_trump2_pre)) * -1
dat$closebusiness_trump_learn3 <- (dat$closebusiness_trump2_post - ifelse(is.na(dat$closebusiness_trump2_pre), 2, dat$closebusiness_trump2_pre)) * -1
dat$who_trump_learn3 <- (dat$who_trump2_post - ifelse(is.na(dat$who_trump2_pre), 2, dat$who_trump2_pre)) * -1

dat$maskspublic_biden_learn3 <- (dat$maskspublic_biden2_post - ifelse(is.na(dat$maskspublic_biden2_pre), 2, dat$maskspublic_biden2_pre))
dat$closebusiness_biden_learn3 <- (dat$closebusiness_biden2_post - ifelse(is.na(dat$closebusiness_biden2_pre), 2, dat$closebusiness_biden2_pre))
dat$who_biden_learn3 <- (dat$who_biden2_post - ifelse(is.na(dat$who_biden2_pre), 2, dat$who_biden2_pre))

# Function to calculate simple average ignoring NAs
calculate_average <- function(...) {
  vars <- list(...)
  rowMeans(do.call(cbind, vars), na.rm = TRUE)
}

# Calculate the average of the six variables
dat$coronavirus_learn3 <- calculate_average(
  dat$maskspublic_trump_learn3,
  dat$closebusiness_trump_learn3,
  dat$who_trump_learn3,
  dat$maskspublic_biden_learn3,
  dat$closebusiness_biden_learn3,
  dat$who_biden_learn3
)
#sapply(dat[, c("maskspublic_trump_learn3", "closebusiness_trump_learn3", "who_trump_learn3", "maskspublic_biden_learn3", "closebusiness_biden_learn3", "who_biden_learn3", "coronavirus_learn3")], function(x) sum(is.na(x)))
#summary(dat[, c("maskspublic_trump_learn3", "closebusiness_trump_learn3", "who_trump_learn3", "maskspublic_biden_learn3", "closebusiness_biden_learn3", "who_biden_learn3", "coronavirus_learn3")])
# Create the density plot for coronavirus_learn3 ignoring missing values



# Cronbach's alpha for coronavirus scale
dat %>% dplyr::select(maskspublic_you2_pre,who_you2_pre,closebusiness_you2_pre,stayathome_pre,protectcoronavirus_pre,coronavirustesting_pre) %>% drop_na()  %>%
   cronbach.alpha(CI = F) -> acorona
```

# Introduction {-}

In one view of democracy, voters reward and punish politicians directly for their policy stances. In another, they're less interested in policy specifics, instead they care about outcomes, such as economic growth. While we have ample evidence that voters reward or punish politicians for their performance on key outcomes, such as growth [@fiorina1981retrospective], it is still unclear whether they reward/punish them by selecting them based on their policy stances. Despite decades of research, we lack a clear answer. 

Whether voters select politicians on policy remains unclear because the study of issue voting is an empirical mindfield. Inferential obstacles have hindered strong conclusions about this core aspect of democratic theory. These obstacles include politicians being strategic enough to avoid adopting policy positions that are sufficiently unpopular to harm them electorally. They also include that, to determine if voters are punishing a candidate for their policy stances, we generally need to know voters’ views on the issue---do they agree or disagree with the politician. But voters’ views may be influenced by the candidates, as they may "follow the leader,” leading to estimates biased by reverse causation. Additionally, although we have aggregate evidence consistent with some (but not a lot of) policy voting [@caneswrone2002; @ansolabehere2001candidate], aggregate studies leave open the question of mechanisms. They don't show that it's voters themselves directly casting votes based on policy stances, not elite actions (e.g., running character-based attack ads against extreme candidates).

```{r,mip-anes,include=FALSE,message=FALSE,warning=FALSE}
d1 <- read.csv("Data/Raw/mip1.csv")
colnames(d1) <- c("rid","mip1")
d2 <- read.csv("Data/Raw/mip2.csv")
colnames(d2) <- c("rid","mip2")
d3 <- read.csv("Data/Raw/mip3.csv")
colnames(d3) <- c("rid","mip3")
d4 <- read.csv("Data/Raw/mip4.csv")
colnames(d4) <- c("rid","mip4")

d <- d1 %>% left_join(d2,by="rid") %>% left_join(d3,by="rid") %>% left_join(d4,by="rid")

mipcovid <- round(mean(apply(cbind(str_detect(d$mip1,regex("covid|pandemic|virus|disease",ignore_case=T)),
                                   str_detect(d$mip2,regex("covid|pandemic|virus|disease",ignore_case=T)),
                                   str_detect(d$mip3,regex("covid|pandemic|virus|disease",ignore_case=T)),
                                   str_detect(d$mip4,regex("covid|pandemic|virus|disease",ignore_case=T))),
                             1,sum)>0,na.rm=T)*100)

```

The 2020 US presidential election provides us with an unusual opportunity to assess policy voting, and especially that voters are themselves casting ballots on policy. Donald Trump, the Republican candidate, took a policy stance out of line with most voters, including his own, on a central issue of the campaign: coronavirus policy. Over the course of the election campaign, Trump consistently downplayed the importance of the virus, refused to wear masks, made fun of those who did, and did not make the pandemic a focus of government policy. He did occasionally make ambiguous statements supporting masks, like asserting that wearing masks is "patriotic." In general, however, he downplayed the virus and public health measures like mandatory mask-wearing, possibly because he expected to win the election on the back of a strong economy and worried that an aggressive government pandemic response would damage it.

<!-- See \url{https://www.nytimes.com/2020/07/21/us/politics/trump-coronavirus-masks.html}.] -->

While Trump was avoiding adopting strong measures to fight the virus, voters greatly feared Covid. With the subsequent polarization around the pandemic response [@gadarian2022pandemic], it's hard to remember just how scared the public was at first. When asked about various threats in early April 2020, the public reported seeing Covid as almost as dangerous as nuclear war [@landau2022seeking]. The public also saw the virus as an important issue through the election. Nearly half of respondents (`r mipcovid`%) to the 2020 American National Election Study mentioned the pandemic when asked about the most important problems facing the US [@anes2021].^[We count all respondents who used one of the following in responding to the four questions about the most important problems facing the US: Covid, disease, pandemic, and virus.] The pandemic seemed far from over on Election Day 2020, and voters were still apparently focused on choosing a president that would lead them out of the crisis. 

Trump therefore took an unpopular stance on a policy of great concern to the public. Moreover, voters were unaware of the extent to which they disagreed with him before the campaign, as we show below. So, Trump faced the prospect of many voters learning about his stance. Several of Trump's advisers including the Republican National Committee chair, Ronna McDaniel, saw Trump's stance on Covid as a serious blunder. They pleaded with him to support masks and other aggressive policies on the virus, policies Trump’s own polling showed his voters widely supported [@bender2021frankly, 240-41]. In a July 20, 2020, Oval Office meeting, for instance, Trump's pollster Tony Fabrizio reportedly told him: 

\singlespacing

> a majority of Trump voters favored requiring masks to keep the country open; most favored an Executive Order requiring masks for indoor public places, two-thirds of Trump voters thought the president's wearing a mask would set a good example and be an act of patriotism; and eight of ten of Trump voters supported wearing a mask as a preventative measure [@wolff2021landslide, 22-23]. 

\doublespacing

Trump reportedly responded to Fabrizio: "I know my people. They won't have it. They don't believe it. No mask mandates!" [@wolff2021landslide, 23]. After Trump contracted the virus at a key moment in the campaign, some of his advisors pleaded with him for a reset. Instead, his response was to tell Americans: "Don't be afraid of it" [@bender2021frankly, 285]. See Online Appendix Section \@ref(trump-stance) for more about Trump's Covid stance.

Given Trump's stance on the virus, we have a rare opportunity to examine whether voters learn what they need to know to punish an incumbent politician for taking an unpopular stance because we have what appears to be a major blunder. Moreover, unlike policies like gun control which only some voters care deeply about [@hill2022frustrated], Covid affected everyone in 2020, either by putting their health at risk or by imposing restrictions on their behavior. We can also overcome another inferential problem---reverse causation (following the leader)---because we ran a panel study of the 2020 election that assessed respondents’ views on the virus before many learned about Trump’s stance. We therefore can avoid the problem of reverse causation that plagues cross-sectional studies of issue voting. Finally, unlike aggregate studies, we can directly observe whether voters are learning the candidate stances and how they react when they realize they are out of sync with their favorite candidate. 

Consistent with Trump's own polling, we find that many Trump voters in early August 2020 wanted more aggressive policies to fight the coronavirus and thus disagreed with Trump. On four of the six coronavirus issues we asked about, majorities of Trump voters disagreed with him. Our key finding is that Trump voters remain largely ignorant of Trump's stance. For example, during the campaign, the percent who said Biden favored requiring masks more than Trump only increases by about 20 percentage points, and only reaches 40% at the end of the campaign (among Trump voters who supported requiring masks). Among the 20% that learn the candidates' relative positions, we don't see clear signs that they shifted away from him, though our estimates are understandably imprecise given the small number who learn the relative positions. Instead of learning and changing votes, we find that people learn and then follow their preferred candidate, changing their views on Covid accordingly. While we find that most initial Trump supporters did not shift away from him after he took an unpopular stance on the coronavirus, the small minority who did could still have been influential because the election was so close. These findings are important because they show that, even in a crisis, most voters appear not to learn they disagree with their candidate and, if they do learn, react by following, and so few likely ultimately abandon their candidate. 

These findings survive several potential inferential threats. Trump voters—and the public generally—held stable Covid attitudes throughout the 2020 election, making weakly held attitudes an unlikely explanation. Voters consistently viewed Covid as an important election issue, ruling out low issue salience. Similar patterns among moderate respondents suggest polarization does not fully explain our results. Politically knowledgeable respondents saw clear differences between Trump and Biden, making an ambiguous stance by Trump unlikely. Our panel respondents closely mirrored actual election results and appeared attentive, reducing concerns about sample quality. Finally, although our panel spans only August to November, missing earlier learning is not a threat because Trump voters just never learn much about Trump's and Biden's stances.

# Do Voters Reward/Punish Politicians for Their Policy Stances?  {-}
In the study of democracy, scholars have long discussed different views of how voters govern through their representatives. In the policy-voting view, voters select candidates based on their policy views or ideologies [@arrow1951; @downs1957; @dahl1956preface; @riker1953democracy; @black1948rationale; @black1958theory]. Dahl’s concept of “Populistic Democracy” comes closest to this view of voters.  Writing about this notion, Dahl says popular sovereignty requires that “whenever policy choices are perceived to exist, the alternative selected and enforced as governmental policy is the alternative most preferred by the members” of the relevant political community (Dahl 1956, 37). Early in his career, William Riker expressed a similar view, writing “truly responsible government is only possible when elections are so conducted that a choice of men is a decision on policy” (1953, 91–92). In the performance view, on the other hand, voters lack the interest or the resources to develop views on specific policies and so govern through evaluating performance on outcomes. 

Given the lack of an incentive for voters to learn about politics and policy---the chance they will ever be pivotal in elections is minuscule---they may lack the knowledge necessary to develop policy views and connect those views to their voting decisions. Determining whether voters select candidates on policy is therefore an important question with a non-obvious answer. The question is not whether any voters do---with millions of voters, some undoubtedly do---but whether this tendency is common enough to matter to election outcomes. This is the core question this paper attempts to address: how frequently do citizens judge candidates on their policy stances.

In their quest to determine whether voters select candidates on their policy stances, researchers have utilized various empirical approaches, but have faced major inferential challenges. One approach uses survey data at the individual level: researchers examine whether voters who agree (disagree) with a candidate on a particular policy support that candidate more (less). In such cross-sectional analyses, however, researchers can't know what is the cause and what is the effect. If they find signs of policy voting, it could reflect real policy voting or it could simply reflect voters "following the leader," that is, adopting the policy stance of their preferred candidate as their own [@brody1972; @lenz2012; @slothuus2021political]. To address reverse causation, the ideal experiment would randomly assign voters to hold particular policy views and then observe whether they subsequently change their voting decisions accordingly. Of course, this experiment is not easily run, to say the least. Analysis with panel data may help sort out causation, since it allows researchers to observe policy views (the purported cause) before changes in voting decisions (the effect). We pursue this approach in this paper. 

<!-- With individual-survey level data, researchers face another challenge. Scholars beginning at least with the authors of *The American Voter* [@campbell1960] have been aware that citizens face challenges connecting their policy views on individual issues to their vote choice given their low levels of political knowledge. However, @converse1964 argued that citizens may be able to connect their policy views to their vote choice on issues that are important to them. This argument, later elaborated by @krosnick1988, suggests that, while citizens do not connect their policy views to their vote choice most of the time, they do connect their votes to their policy views on issues important to them. Evidence supporting 'issue publics' has been surprisingly elusive [@bartle2012;@grynaviski2006;@guntermann2021;@leeper2020;@zaller1986analysis]. Voters who identify an issue as important do not consistently hold politicians more accountable on that issue (that is, it doesn't receive greater weight in vote choice regression models). -->

Researchers have also studied policy voting with aggregate data. A number of such studies find that voters punish politicians who are ideologically extreme [e.g., @caneswrone2002], though the size of these effects appears limited [@ansolabehere2001candidate]. Indeed, only small effects would seem consistent with the high degree of ideological polarization among members of Congress in recent decades. Aggregate studies have also searched for this pattern on specific bills, such as whether members of Congress who voted for the Affordable Care Act suffered electorally [@nyhan2012one].[^575] Although these studies are intriguing, they also suffer from the standard inferential problems with cross-sectional, observational data. Their findings may reflect, not voters punishing candidates because they are personally judging them for their stances, but instead voters punishing them because other elites and the media reacted negatively to such candidates. For example, voters may have punished members of Congress who voted for the Affordable Care Act, not because they disliked the details of the policy, but because elites poured resources into portraying representatives as out-of-step with their districts. Similar elite behavior could explain the aggregate-level findings that voters punish extreme candidates. 

The aggregate studies, therefore, don't reveal the mechanism---they don't reveal whether it's voters or elites selecting candidates on policy. Elite control of policy would still be an important finding in its own right, but is a distinct channel from voters. For Democratic theory, we want to know whether voters can step in and meaningfully constrain politicians on policy.  

[^575]: @nyhan2012one combines aggregate vote-share analysis and survey data, finding that, when representatives voted for the Affordable Care Act, voters came to see them as more liberal and, as a result, were less likely to vote for them.

In observational approaches, a failure to find voters punishing candidates for holding unpopular stances may simply reflect strategic behavior by the candidates, not voter behavior. Politicians may rarely adopt stances that are unpopular enough to harm them on Election Day. US political history is replete with politicians attempting to neutralize potentially damaging issues as Election Day approaches by adopting popular stances, e.g., President Theodore Roosevelt curbing the power of trusts before the 1904 election [@morris2001theodore], President Harry Truman enacting the Loyalty Order to neutralize the communism issue before the 1948 election [@bernstein1990loyalties], President Lyndon Johnson broadening the Vietnam war in the months before facing Barry Goldwater in the 1964 election [@berman1982planning], Vice President George H. W. Bush persuading President Ronald Reagan to support a minimum wage increase before the 1988 election [@brady2018revolving], and George W. Bush supporting the Medicare drug benefit before the 2004 election [@brewer2020parties]. Of course, this doesn't mean politicians are never out-of-step with their voters---they often are---just that they avoid being too out-of-step on issues that matter to voters on Election Day. If politicians successfully avoid potentially damaging stances, we may rarely be able to detect policy voting in observational data, even if the threat of it is ever present. 

Researchers have avoided some of the problems with observational data with survey experiments. In these studies, they randomly assign fictitious candidates to hold certain policy stances, therefore overcoming the problem of strategic positioning. Interestingly, these studies do find evidence of issue voting [e.g., @tomz2008candidate]. However, these studies face external validity challenges. Most importantly, they ensure voters surmount probably the greatest hurdle to issue voting: they inform voters about the policy stances of the candidates. In the real world, we know that many voters don't know the stances politicians take, even on highly salient, long-standing issues [@layman2002party; @freeder2019; @lenz2012]. The survey experimental studies are important. They show that voters can vote based on issues, and how they may vote on issues, but they don't reveal the extent of this behavior in actual elections, where knowledge is scarce. Also, social desirability bias potentially poses an external validity threat [@rosenthal_7_2009; @dodou2014social]. Respondents, aware they are under study, may see "good citizens" as issue-oriented ones. Consequently, they may align their votes with their policy views more than they typically would in the privacy of the voting booth, where the gaze of researchers is absent. 

To summarize, studying whether voters judge politicians on their policy stances is hard. The approaches researchers have taken all yield insights yet face inferential threats. Our study is no different. It has several strengths. Unlike aggregate studies, our survey data allow us to examine the core mechanism through which voters control the policies politicians pursue: whether voters learn what they need to know to directly select candidates on their policy stances and whether voters act on that knowledge. Unlike cross-sectional survey studies, the panel data allow us to rule out the possibility that any findings are driven by voters following politicians (reverse causation). Unlike many observational studies, we avoid problems with strategic positioning because the politician in our case appears to have knowingly adopted an unpopular stance. Unlike experimental studies, we observe, in a real campaign, whether people learn the information they need. As we discuss in our conclusion, our approach also has weaknesses. 

# Related Literatures   {-}
Our paper is related to a number of other literatures. We focus on determining whether voters are selecting candidates based on their policy stances, not whether they are rewarding or punishing based on outcomes, which we call performance voting. Several studies have studied performance accountability on Covid. They examine whether voters punished Trump for Covid infections or deaths at the local level [@baccini2021; @warshaw2020; @sides2022bitter; @algara2024nail]. These studies have produced mixed results. @sides2022bitter and @algara2024nail find that Trump actually did better in counties that experienced more cumulative deaths from Covid compared to counties that experienced fewer deaths---possibly because some Republican voters, taking Trump's cue, took the pandemic less seriously. Of course, voters tend to be nationally focused when it comes to presidential elections, so punishment may only have occurred at the national level. When we compare Trump to leaders of other similar countries, we find that he missed the popularity boost voters granted leaders who seemingly took the virus seriously [@sides2022bitter], which could represent a form of punishment for poor performance (of course, voters may have been rewarding the appearance of effort rather than actual effort or successful policy). A more general literature on performance voting suggests voters do hold politicians accountable for outcomes like the economy in the election year [e.g., @fiorina1981retrospective]. 

The distinction between policy voting and performance voting is closely tied to another distinction in the literature, that between voters selecting "good types" of candidates and voters sanctioning incumbents they are unhappy with. By "good types," researchers mean politicians possessing attributes voters desire, such as competent politicians or politicians with particular policy views. By sanctioning, scholars mean punishing incumbents on Election Day who fail to pursue the policies or the outcomes voters desire. In models of policy voting, selection and sanctioning are closely intertwined. Indeed, @fearon_electoral_1999 shows that models combining both become models of selection. Scholars have also studied policy accountability during times of crisis, including theoretical studies [@bils2022policymaking; @ashworth2018learning] and empirical studies [@healy2009myopic; @achen2017democracy]. 

For many policies like Covid, voters can focus on policy stances (e.g., mandatory masks), on outcomes  (e.g., deaths), or on some mix of the two. Acquiring information is costly for voters---levels of knowledge about politics and public affairs are generally low. Like most policy issues, Covid was a technical area where experts did not always agree. A literature in formal theory has examined accountability when voters face high information costs and have low quality information about outcomes [e.g., @maskin2004politician]. Given the complexity of policy, voters may govern more by sanctioning politicians based on outcomes than by selecting candidates on policy [@stokes1963spatial]. 

Researchers have also studied the state and local response to Covid, finding that governors tended to take their cues from national elites, with Republican governors taking a more relaxed approach and Democratic governors taking a more aggressive one [@kincaid2021covid; @birkland2021governing]. These divergent reactions may have helped voters figure out Trump's and Biden's Covid stances, because they should have helped them infer that Democrats supported more aggressive Covid policies than Republicans.

# The Panel Survey  {-}
To study whether voters abandoned Trump after he took an unpopular stance on Covid, we conducted a two-wave survey using the online survey provider Lucid. Just under 4,000 respondents participated in the pre-election survey between August 19th and 21st. We successfully re-contacted `r nrow(dat)` after the election (between November 5th and December 21st).  We designed this survey to measure respondents' own views about the virus as well as their knowledge of Trump's and Biden's stances. We asked six questions about coronavirus policy attitudes. Three of the questions asked respondents whether they agreed or disagreed with three policies: mandatory masks in public, closing non-essential businesses, and United States membership in the WHO. They also asked respondents to place each major party candidate into one of those categories for each issue. Three other questions asked respondents how much effort they want from the federal government in three other areas: coronavirus testing, making sure people with the coronavirus stay at home, and protecting Americans from the coronavirus. We also asked respondents about a variety of other policies. See Tables \@ref(tab:issues)-\@ref(tab:issues-spending) in the for lists of all policy questions.  

The survey demographics are broadly representative of the American public (see Table \@ref(tab:demotab)). Moreover, the survey closely matches the actual election vote. In our post-election interviews, `r Trump_p`% reported a Trump vote and `r Biden_p`% a Biden vote, not far from the 46.9% and 51.3% that Trump and Biden actually received. Since the survey matches the public and the vote quite well, we conduct unweighted analyses (the weighted results are very similar, see Section \@ref(analyses-weights)).

We find little sign that differential attrition could have generated our findings since we think it should bias estimates against them. In particular, knowledgeable participants disproportionately responded to our second-wave survey. Even though our panelists are therefore extra knowledgeable, the percent of initial Trump voters aware that Trump was out-of-step on Covid remains low in the second survey. To further examine the threat posed by differential attrition, we simulate the responses of those who dropped out on our key outcomes (see Section \@ref(analyses-attrition)). Although the simulations depend on numerous assumptions, they provide some further reassurance that differential attrition does not bias the estimates of learning, knowledge, and shifting away from Trump in favor of our findings.

# A Major Blunder?  {-}
Trump voters strongly supported four of the six policies we asked about: coronavirus testing, making people stay at home, protecting Americans from the virus, and mandatory masks in public [@guntermann2021]. Many Trump supporters also supported closing non-essential businesses to fight the virus and WHO membership. Among our `r nrow(dat)` panel respondents,  `r nrow(dat[which(dat$vote_pre=="Trump"),])` intended to vote for Trump in August. Figure \@ref(fig:agree) shows their responses to each of our six coronavirus policy questions. The top panel shows responses to a question asking respondents how much effort they want from the federal government on three issues: coronavirus testing, making people stay at home, and protecting Americans from the coronavirus. For each, respondents could choose between five options from "much more than now" to "much less than now." The bottom panel shows responses to questions asking respondents whether they "agree," "disagree," or "neither agree nor disagree" with three policies: mandatory masks in public, closing non-essential businesses, and WHO membership. The figure shows that Trump was largely out-of-step with his own supporters, especially on the amount of government effort and on masks. Nevertheless, their support for requiring masks in public was considerably higher than their support for closing non-essential businesses, suggesting that they wanted to protect themselves from the virus without shutting down the economy. We also find that support for policies to fight the virus extends across the public, including across racial and ethnic groups (see Section \@ref(race-ethnicity)). Across these issues, Trump was out of line with between 30% and 60% of his voters. No small number.

It is possible that Trump voters' views on the virus were not strongly held. As @converse1964 noted, people often lack stable political views even on important policy issues to the point where they resemble "non-attitudes" [@converse1970]. It is also possible that even those with strongly held attitudes changed them in the fall of 2020 as they learned more about the virus. To examine attitude stability, we create an index by taking the simple mean of the coronavirus policy questions for each respondent in each wave, rescaled to vary from 0 to 1, with higher values indicating stronger support (Cronbach's alpha `r round(acorona$alpha,2)`).\footnote{We consider all coronavirus policy questions each respondent answered in order to avoid listwise deletion.} On this scale, initial Trump voters had a mean of `r  format(round(mean(dat$coronavirus_pre[dat$vote_pre=="Trump"], na.rm=T), 2), nsmall = 2)` pre-election and `r  round(mean(dat$coronavirus_post[dat$vote_pre=="Trump"],na.rm=T),2)` post-election. `r dat %>% filter(vote_pre=="Trump"&coronavirus_pre>0.5) %>% summarise(round(100*mean(coronavirus_post>0.5,na.rm=T)))`% of initial Trump voters above the midpoint on this scale in August still held that view post-election (Figure \@ref(fig:agreepost) reproduces Figure \@ref(fig:agree) with post-election responses). The correlation between pre-election and post-election attitudes for initial Trump voters was `r  round(cor(dat$coronavirus_pre[dat$vote_pre=="Trump"],dat$coronavirus_post[dat$vote_pre=="Trump"],use="complete.obs"),2)` and for all respondents `r  round(cor(dat$coronavirus_pre,dat$coronavirus_post,use="complete.obs"),2)`.  Thus, Trump supporters held stable views on the virus and so did the public more generally. At this early point in the pandemic, the public was scared and wanted the government to keep them safe---a viewpoint maintained through November 2020.

Not only was Trump out-of-step, but his voters remained largely unaware of his stances before the campaign. In the survey, we asked for perceptions of Trump's and Biden's positions on three Covid issues: mandatory masks, closing non-essential businesses, and WHO membership. We asked these on a three-point scale: "agree" with the policy, "disagree," and "neither agree nor disagree."^[Since we asked respondents to place the candidates on so many policy items, we adopted three-point scales to reduce fatigue. We did not provide a "don't know" option, but respondents could skip.] Ideally, we would have asked about Trump's and Biden's support for government efforts on the virus as well, but we suspect the mask question tracks it closely. 

In presenting statistics on knowledge of the candidate stances, we focus on the initial Trump voters who disagreed with Trump, since these were the voters for whom learning could pose a threat of defection. Of the `r nrow(dat[which(dat$vote_pre=="Trump"),])` initial Trump voters, `r nrow(dat[which(dat$vote_pre=="Trump"&dat$maskspublic_you_pre=="Agree"),])` disagreed with him on masks, `r nrow(dat[which(dat$vote_pre=="Trump"&dat$closebusiness_you_pre=="Agree"),])` disagreed with him on closing businesses, and `r nrow(dat[which(dat$vote_pre=="Trump"&dat$who_you_pre=="Agree"),]) ` disagreed with him on the WHO. If all voters who disagreed with Trump abandoned him, he could have lost up to 57% of his voters on Election Day (i.e., the percentage who disagreed with him on masks). 

Figure \@ref(fig:know) shows the arguably low level of knowledge among initial Trump voters who supported these Covid policies. Its bars show the percent who placed Biden as more supportive of each policy than Trump, the percent who saw Biden as less supportive, the percent who placed Trump and Biden at the same position, and the percent who skipped the question. On each issue, only between a fifth and a quarter of initial Trump supporters who disagreed with him placed Biden as more strongly supporting each policy than Trump. Trump therefore faced the threat that his own voters would learn about his stance on Covid as they tuned in to the campaign. If all voters who disagreed with Trump and did not know the candidates' positions learned the positions and abandoned him, Trump would have lost up to 46% of his voters (i.e. the percentage of Trump voters who disagreed with him on masks and did not know the candidates' relative stances in the first wave).\footnote{It's possible, one anonymous reviewer suggests, that Trump voters placed Trump as more supportive of masks due to perceived hypocrasy among Democrats, whereby Democrats joined in Black Lives Matter protests while insisting that Americans otherwise stay home.} Figures \@ref(fig:agreeBiden) and \@ref(fig:knowBiden) show these plots for Biden voters.

```{r agree,message = F, warning = F, include = T, echo=F,cache = T,fig.height=8,fig.width=6.5,fig.cap="Trump voters' views on coronavirus policies in the August 2020 wave of the panel survey. In the top panels, the symbols indicate as follows: ++ `much more than now,' + `somewhat more than now,' = `the same as now,' - `somewhat less than now,' -- `much less than now.'",echo=FALSE}
#First set of issues
wide_df <- dat %>% dplyr::select(coronavirustesting_pre, stayathome_pre, protectcoronavirus_pre,vote_pre)
long <- as.data.frame(pivot_longer(wide_df, cols = 1:3, names_to = 'youq', values_to = 'you'))

d <- long %>% filter(vote_pre=="Trump"& !is.na(you)) %>% group_by(youq,you) %>% 
  summarise(value=n()) %>%  mutate(percent=100*value/sum(value))%>%ungroup() 
d$youq[d$youq=='coronavirustesting_pre']<-'Coronavirus Testing'
d$youq[d$youq=='stayathome_pre']<-'Making People Stay at Home'
d$youq[d$youq=='protectcoronavirus_pre']<-'Protecting Against Coronavirus'
d$youq <- factor(d$youq)
d$you <- as.factor(d$you)
levels(d$you) <- c("--","-","=","+","++")
d$percent_lab <- str_c(round(d$percent),"%")
d$y <- d$percent+3
a<-ggplot(d,aes(x=you,y=percent,label=percent_lab)) + 
  geom_bar(stat="identity",position="stack") +
  facet_wrap(vars(youq), nrow = 1)+xlab("") + ylab("Percent") +
  theme(text = element_text(size=9.75)) + 
  ggtitle("(a) How much effort do you want from the federal government on ...") + geom_text(mapping=aes(you,y,label=percent_lab),size=3) + theme(plot.title = element_text(size=10))

#Second set
wide_df <- dat %>% dplyr::select(maskspublic_you_pre, closebusiness_you_pre, who_you_pre,vote_pre)
long <- as.data.frame(pivot_longer(wide_df, cols = 1:3, names_to = 'youq', values_to = 'you'))
long$you <- as.character(long$you)
long$you[is.na(long$you)] <- "Missing"
long$you <- factor(long$you,levels=c("Disagree","Neither agree nor disagree","Missing","Agree"))
d <- long %>% filter(vote_pre=="Trump") %>% group_by(youq,you) %>% 
  summarise(value=n()) %>% ungroup()  %>% group_by(youq)  %>%  mutate(percent=100*value/sum(value))

d$youq[d$youq=='maskspublic_you_pre']<-'Mandatory Masks in Public'
d$youq[d$youq=='closebusiness_you_pre']<-'Closing Non-Essential Businesses'
d$youq[d$youq=='who_you_pre']<-'WHO Membership'
d$youq <- factor(d$youq,levels = c('Mandatory Masks in Public','Closing Non-Essential Businesses','WHO Membership'))
d <- d[d$you!="Missing",]

d <- d %>% group_by(youq,you) %>% mutate(percent_lab=sum(percent)) %>% mutate(tot=percent_lab,y=percent_lab+3,percent_lab=str_c(round(percent_lab),"%")) 

levels(d$you)[2]<-"Neutral"
d$you <- factor(d$you,levels=c("Disagree","Neutral","Agree"))  
b<-ggplot(d,aes(x=you,y=percent)) + 
  geom_bar(stat="identity",position="stack") +
  facet_wrap(vars(youq), nrow = 1)+xlab("") + ylab("Percent")+ 
  theme(text = element_text(size=9.75),legend.position = "bottom",legend.margin=margin(c(1,1,1,1)))+ 
  ggtitle("(b) Respondent view on ...") + geom_text(mapping=aes(you,y=y,label=percent_lab),size=3) + theme(plot.title = element_text(size=10))
 
grid.arrange(a,b,nrow=2,heights=c(1,1.1))

```

```{r know,cache=TRUE,fig.cap="Awareness of the candidates' stances on Covid issues among Trump supporters who disagreed with him on each issue in the August 2020 wave (pre). This figure shows that most initial Trump voters who agreed with the three Covid policies (and therefore disagreed with Trump) either thought Biden and Trump had the same position (B=T) or that Trump supported the policy more than Biden (T>B). Few placed Biden as more supportive than Trump (B>T)."}
# Knowledge variables
dat$kn_masks <- NA
dat$kn_masks[dat$maskspublic_trump2_pre<dat$maskspublic_biden2_pre] <- "B>T"
dat$kn_masks[dat$maskspublic_trump2_pre==dat$maskspublic_biden2_pre] <- "B=T"
dat$kn_masks[dat$maskspublic_trump2_pre>dat$maskspublic_biden2_pre] <- "T>B"
dat$kn_masks <- as.factor(dat$kn_masks)

dat$kn_business <- NA
dat$kn_business[dat$closebusiness_trump2_pre<dat$closebusiness_biden2_pre] <- "B>T"
dat$kn_business[dat$closebusiness_trump2_pre==dat$closebusiness_biden2_pre] <- "B=T"
dat$kn_business[dat$closebusiness_trump2_pre>dat$closebusiness_biden2_pre] <- "T>B"
dat$kn_business <- as.factor(dat$kn_business)

dat$kn_who <- NA
dat$kn_who[dat$who_trump2_pre<dat$who_biden2_pre] <- "B>T"
dat$kn_who[dat$who_trump2_pre==dat$who_biden2_pre] <- "B=T"
dat$kn_who[dat$who_trump2_pre>dat$who_biden2_pre] <- "T>B"
dat$kn_who <- as.factor(dat$kn_who)

wide_df <- dat %>% dplyr::select(kn_masks, kn_business, kn_who,vote_pre,maskspublic_you_pre,closebusiness_you_pre,who_you_pre)
long <- as.data.frame(pivot_longer(wide_df, cols = 1:3, names_to = 'knowq', values_to = 'know'))

# Only include those who disagreed with Trump (i.e. agreed with policies)
long <- long %>% filter((knowq=="kn_masks" & maskspublic_you_pre=="Agree") | (knowq=="kn_business" & closebusiness_you_pre=="Agree") | (knowq=="kn_who" & who_you_pre=="Agree"))
d <- long %>%   filter(vote_pre=="Trump") %>% group_by(knowq,know) %>% 
  summarise(value=n()) %>% ungroup()  %>% group_by(knowq)  %>%  mutate(percent=100*value/sum(value))

d$knowq[d$knowq=='kn_masks']<-'Mandatory Masks in Public'
d$knowq[d$knowq=='kn_business']<-'Close Non-Essential Businesses'
d$knowq[d$knowq=='kn_who']<-'WHO Membership'

d <- d %>% mutate(y=percent+3,percent_lab=str_c(round(percent),"%")) 
d$know <- factor(d$know,levels=c("B>T","B=T","T>B"))
d$knowq <- factor(d$knowq,levels = c('Mandatory Masks in Public',
                                   'Close Non-Essential Businesses','WHO Membership'))
ggplot(d,aes(x=know,y=percent)) + 
  geom_bar(stat="identity",position="stack") +
  facet_wrap(vars(knowq), nrow = 1)+xlab("") + 
  ylab("")+ 
  theme(text = element_text(size=9.75),legend.position = "bottom",legend.margin=margin(c(1,1,1,1)))+
  geom_text(mapping=aes(know,y=y,label=percent_lab),size=3)

```

Did Trump voters learn about his stance during the campaign? Campaigns may play an important role in democracy by informing voters about poor performance by incumbents or unpopular policies pursued by incumbents. For the three issues (mandatory masks in public, closing non-essential businesses, and WHO membership) for which we asked respondents to place the candidates on the issues, we can determine how many respondents learned during the campaign that they disagreed with their candidate.  

We measure learning about Trump's and Biden's Covid stances with two measures. The first measures whether people shift their perceptions in the correct direction. We therefore code Trump supporters who perceived Trump as supporting each policy less after the campaign and/or Biden as supporting it more than before as having learned. We also find it useful to break non-learners into those who project and those who neither learn nor project. Projection occurs when respondents project their own views on to their candidate or the opposite of their view on to the other candidate, operationalized here as placements of one or both candidates shifting away from reality. We code those who projected on one and learned on the other as neither learning nor projecting.

Figure \@ref(fig:supplearn)(a) shows the distribution for this first learning measure: the percent in each learning category among initial Trump voters who disagreed with Trump on Covid. It shows that between 36% and 56% of initial Trump voters who disagreed with him shifted their perceptions in the correct direction. 
However, our second learning measure suggests that, though voters shifted their perceptions in the correct direction, those shifts largely didn't lead them to see Biden as tougher on Covid than Trump. Figure \@ref(fig:supplearn)(b) presents the change in knowledge using the same coding as Figure \@ref(fig:know), showing the percent who placed Biden as pursuing a more aggressive Covid-19 policy than Trump in August and November. (Figure \@ref(fig:supplearnBiden) shows a similar plot for initial Biden voters.) We call this the relative learning measure. On mandatory masks, `r round(mean(dat$maskspublic_cand_pre[dat$vote_pre=="Trump"& dat$maskspublic_you_pre=="Agree"],na.rm = T),2)*100`% of initial Trump voters who disagreed with him placed Biden as more supportive of masks in August and `r round(mean(dat$maskspublic_cand_post[dat$vote_pre=="Trump"&dat$maskspublic_you_pre=="Agree"],na.rm = T),2)*100`% did so after the election. On closing non-essential businesses, these percentages are `r round(mean(dat$closebusiness_cand_pre[dat$vote_pre=="Trump"&dat$closebusiness_you_pre=="Agree"],na.rm = T),2)*100`% and `r round(mean(dat$closebusiness_cand_post[dat$vote_pre=="Trump"&dat$closebusiness_you_pre=="Agree"],na.rm = T),2)*100`%. On the WHO, these are `r round(mean(dat$who_cand_pre[dat$vote_pre=="Trump"&dat$who_you_pre=="Agree"],na.rm = T),2)*100`% and `r round(mean(dat$who_cand_post[dat$vote_pre=="Trump"&dat$who_you_pre=="Agree"],na.rm = T),2)*100`%.[^520] These shifts are all highly statistically significant ($p<0.001$) in paired t-tests. 

[^520]: Among all initial Trump voters, these are `r round(mean(dat$maskspublic_cand_pre[dat$vote_pre=="Trump"],na.rm = T),2)*100`% vs. `r round(mean(dat$maskspublic_cand_post[dat$vote_pre=="Trump"],na.rm = T),2)*100`%, `r round(mean(dat$closebusiness_cand_pre[dat$vote_pre=="Trump"],na.rm = T),2)*100`% vs. `r round(mean(dat$closebusiness_cand_post[dat$vote_pre=="Trump"],na.rm = T),2)*100`%, and `r round(mean(dat$who_cand_pre[dat$vote_pre=="Trump"],na.rm = T),2)*100`% vs. `r round(mean(dat$who_cand_post[dat$vote_pre=="Trump"],na.rm = T),2)*100`%. Among all respondents, these are `r round(mean(dat$maskspublic_cand_pre,na.rm = T),2)*100`% vs. `r round(mean(dat$maskspublic_cand_post,na.rm = T),2)*100`%, `r round(mean(dat$closebusiness_cand_pre,na.rm = T),2)*100`% vs. `r round(mean(dat$closebusiness_cand_post,na.rm = T),2)*100`%, and `r round(mean(dat$who_cand_pre,na.rm = T),2)*100`% vs. `r round(mean(dat$who_cand_post,na.rm = T),2)*100`%. 

So, the percentage of these voters who ultimately saw Biden as tougher on Covid than Trump increased by 21%, 24%, and 14%, respectively, across these three policies. The lack of learning and low rates of knowledge appear not attributable to lack of attention (see Section \@ref(attention)). 

Since 57% of initial Trump voters disagreed with him on masks (the issue with the most disagreement) and 21% learned on that issue, we would expect at most 12% (57% times 21%) to defect. Of course, Covid is just one of many considerations on Trump voters' minds, so we would only expect a fraction of these 12% to defect. Moreover, we would expect some of these 12% to change their minds on Covid when they learned Trump's stance, further limiting damage (see below). The failure of more respondents to learn the candidates' relative stances therefore likely limited the damage Covid did to Trump. 

Since our first interviews were in August, we likely missed learning before August. But we know we didn't miss much. Why? Because the post-election percentages of these voters saying Biden supported more aggressive policies than Trump never reaches high levels: only `r round(mean(dat$maskspublic_cand_post[dat$vote_pre=="Trump"&dat$maskspublic_you_pre=="Agree"],na.rm = T),2)*100`% on masks, `r round(mean(dat$closebusiness_cand_post[dat$vote_pre=="Trump"&dat$closebusiness_you_pre=="Agree"],na.rm = T),2)*100`% on closing businesses, and `r round(mean(dat$who_cand_post[dat$vote_pre=="Trump"&dat$who_you_pre=="Agree"],na.rm = T),2)*100`% on the WHO, as noted earlier. Since some respondents may have guessed the correct answer, the true level of knowledge is probably lower. Respondents answering randomly would say Biden was tougher than Trump about one third of the time (one quarter if we allow for skipping, which was exceedingly rare). So, respondents are just a few percentage points above chance---likely because projecting their own views on to Trump reduced accuracy (see Section \@ref(guesscorrection) for guess correction estimates). Since knowledge didn't reach high levels at the end of the campaign, we know we didn't miss much learning. We think these statistics are important because they tell us that, even with a major crisis and even with an out-of-step candidate, voter knowledge just doesn't get high enough to do much damage (among voters initially disagreeing with their candidate, the group where damage is likely).[^467] Besides low levels of knowledge at the end of the campaign, we also think our August wave was not too late because a considerable share of Trump voters remained conflicted on Covid (see Figure 1)---they were voting for Trump yet supported aggressive Covid policies (and mostly said Trump did too). 

[^467]: Another way to assess learning is by whether respondents said Trump agreed with these Covid policies. On mandatory masks `r round(mean(dat$maskspublic_trump_pre[dat$vote_pre=="Trump"& dat$maskspublic_you_pre=="Agree"]=="Agree",na.rm = T),2)*100`% of initial Trump voters who disagreed with him said Trump agreed in August and `r round(mean(dat$maskspublic_trump_post[dat$vote_pre=="Trump"&dat$maskspublic_you_pre=="Agree"]=="Agree",na.rm = T),2)*100`% said so after the election. On closing non-essential businesses, these percentages are `r round(mean(dat$closebusiness_trump_pre[dat$vote_pre=="Trump"&dat$closebusiness_trump_pre=="Agree"]=="Agree",na.rm = T),2)*100`% and `r round(mean(dat$closebusiness_trump_post[dat$vote_pre=="Trump"&dat$closebusiness_you_pre=="Agree"]=="Agree",na.rm = T),2)*100`%. On the WHO, these are `r round(mean(dat$who_trump_pre[dat$vote_pre=="Trump"&dat$who_you_pre=="Agree"]=="Agree",na.rm = T),2)*100`% and `r round(mean(dat$who_trump_post[dat$vote_pre=="Trump"&dat$who_you_pre=="Agree"]=="Agree",na.rm = T),2)*100`%. Among all respondents, these statistics are `r round(mean(dat$maskspublic_trump_pre=="Agree",na.rm = T),2)*100`% vs. `r round(mean(dat$maskspublic_trump_post=="Agree",na.rm = T),2)*100`%, `r round(mean(dat$closebusiness_trump_pre=="Agree",na.rm = T),2)*100`% vs. `r round(mean(dat$closebusiness_trump_post=="Agree",na.rm = T),2)*100`%, and `r round(mean(dat$who_trump_pre=="Agree",na.rm = T),2)*100`% vs. `r round(mean(dat$who_trump_post=="Agree",na.rm = T),2)*100`%. 

```{r learnsig, echo=FALSE, message = F, warning = F, include = F, cache = T}
#statistical significance tests mentioned in the following paragraph
t.test(dat$maskspublic_cand_pre[dat$vote_pre=="Trump"&dat$maskspublic_you_pre=="Agree"],
       dat$maskspublic_cand_post[dat$vote_pre=="Trump"&dat$maskspublic_you_pre=="Agree"], 
       na.rm = T,
       paired = TRUE)
t.test(dat$closebusiness_cand_pre[dat$vote_pre=="Trump"&dat$closebusiness_you_pre=="Agree"],
       dat$closebusiness_cand_post[dat$vote_pre=="Trump"&dat$closebusiness_you_pre=="Agree"], 
       na.rm = T,
       paired = TRUE)
t.test(dat$who_cand_pre[dat$vote_pre=="Trump"&dat$who_you_pre=="Agree"],
       dat$who_cand_post[dat$vote_pre=="Trump"&dat$who_you_pre=="Agree"], 
       na.rm = T,
       paired = TRUE)
t.test(dat$maskspublic_cand_pre,
       dat$maskspublic_cand_post, 
       na.rm = T,
       paired = TRUE)
t.test(dat$closebusiness_cand_pre,
       dat$closebusiness_cand_post, 
       na.rm = T,
       paired = TRUE)
t.test(dat$who_cand_pre,
       dat$who_cand_post, 
       na.rm = T,
       paired = TRUE)

```

```{r supplearn, fig.height=9,fig.width=8,echo=FALSE, message = F, warning = F, include = T, cache = T, fig.cap="Learning Trump's and Biden's Covid stances among initial Trump supporters who initially disagreed with Trump on each issue. Using two learning measures, the figure shows that some Trump voters who disagreed with him on Covid policy learned they disagreed with him during the campaign. In the top panel, `projected’ means perceptions shifted in the wrong direction. This article focuses on the relative learning measure, since we would only expect defections among those who came to see Biden as more aggressive than Trump on Covid."}
# Directional Learning measure
d1 <- dat %>% filter(vote_pre=="Trump"  & 
                       maskspublic_you_pre=="Agree") %>% group_by(learned_masks) %>% 
  summarise(value=n()) %>% ungroup() %>% mutate(percent=100*value/sum(value))
d1$q <- "Mandatory Masks in Public"

d2 <- dat %>% filter(vote_pre=="Trump" &closebusiness_you_pre=="Agree") %>% 
  group_by(learned_closebusiness)%>% summarise(value=n()) %>% ungroup() %>% mutate(percent=100*value/sum(value))
d2$q <- "Close Non-Essential Businesses"

d3 <- dat %>% filter(vote_pre=="Trump" &
                       who_you_pre=="Agree") %>% group_by(learned_who) %>%
  summarise(value=n()) %>% ungroup() %>% mutate(percent=100*value/sum(value))
d3$q <- "WHO Membership"

d1<-rename(d1,learned=learned_masks);d2<-rename(d2,learned=learned_closebusiness);d3<-rename(d3,learned=learned_who)
d<-bind_rows(d1,d2,d3)

d <- d %>% group_by(learned,q) %>% mutate(z=percent+1)
d$percent_label <- as.character(round(d$percent))
d$percent_label <- str_c(d$percent_label,"%",sep=" ")

d$q <- factor(d$q,levels=c("Mandatory Masks in Public", "Close Non-Essential Businesses", 
"WHO Membership"))
a<-ggplot(d,aes(x=learned,y=percent)) + 
  geom_bar(stat="identity",position="stack") + scale_fill_grey(name="Shifted away from Trump") +
  facet_wrap(vars(q), nrow = 1)+xlab("") + ylab("Percent") + 
  theme(legend.position = "bottom",legend.margin=margin(c(1,1,1,1))) +
  geom_text(mapping=aes(learned,z,label=percent_label),colour="black", size =3) +
  ggtitle("(a) Directional Learning Measure: Perceptions of Trump or Biden Shifting in the Right Direction") + 
  theme(plot.title = element_text(size=10))

#Relative learning measure 
dat$kn_masks_pre <- dat$kn_masks
dat$kn_business_pre <- dat$kn_business
dat$kn_who_pre <- dat$kn_who

dat$kn_masks_post <- NA
dat$kn_masks_post[dat$maskspublic_trump2_post<dat$maskspublic_biden2_post] <- "B>T"
dat$kn_masks_post[dat$maskspublic_trump2_post==dat$maskspublic_biden2_post] <- "B=T"
dat$kn_masks_post[dat$maskspublic_trump2_post>dat$maskspublic_biden2_post] <- "T>B"
dat$kn_masks_post <- as.factor(dat$kn_masks_post)

dat$kn_business_post <- NA
dat$kn_business_post[dat$closebusiness_trump2_post<dat$closebusiness_biden2_post] <- "B>T"
dat$kn_business_post[dat$closebusiness_trump2_post==dat$closebusiness_biden2_post] <- "B=T"
dat$kn_business_post[dat$closebusiness_trump2_post>dat$closebusiness_biden2_post] <- "T>B"
dat$kn_business_post <- as.factor(dat$kn_business_post)

dat$kn_who_post <- NA
dat$kn_who_post[dat$who_trump2_post<dat$who_biden2_post] <- "B>T"
dat$kn_who_post[dat$who_trump2_post==dat$who_biden2_post] <- "B=T"
dat$kn_who_post[dat$who_trump2_post>dat$who_biden2_post] <- "T>B"
dat$kn_who_post <- as.factor(dat$kn_who_post)

wide_df_pre <- dat %>% dplyr::select(kn_masks_pre, kn_business_pre, kn_who_pre,vote_pre,maskspublic_you_pre,closebusiness_you_pre,who_you_pre)
long_pre <- as.data.frame(pivot_longer(wide_df_pre, cols = 1:3, names_to = 'knowq', values_to = 'know'))

wide_df_post <- dat %>% dplyr::select(kn_masks_post, kn_business_post, kn_who_post,vote_pre,maskspublic_you_pre,closebusiness_you_pre,who_you_pre)
long_post <- as.data.frame(pivot_longer(wide_df_post, cols = 1:3, names_to = 'knowq', values_to = 'know'))

# Only include those who disagreed with Trump (i.e. agreed with policies)
long_pre <- long_pre %>% filter((knowq=="kn_masks_pre" & maskspublic_you_pre=="Agree") | (knowq=="kn_business_pre" & closebusiness_you_pre=="Agree") | (knowq=="kn_who_pre" & who_you_pre=="Agree"))

long_post <- long_post %>% filter((knowq=="kn_masks_post" & maskspublic_you_pre=="Agree") | (knowq=="kn_business_post" & closebusiness_you_pre=="Agree") | (knowq=="kn_who_post" & who_you_pre=="Agree"))

d_pre <- long_pre %>%   filter(vote_pre=="Trump") %>% group_by(knowq,know) %>% 
  summarise(value=n()) %>% ungroup()  %>% group_by(knowq)  %>%  mutate(percent=100*value/sum(value))
d_pre$time <- "August"

d_post <- long_post %>%   filter(vote_pre=="Trump") %>% group_by(knowq,know) %>% 
  summarise(value=n()) %>% ungroup()  %>% group_by(knowq)  %>%  mutate(percent=100*value/sum(value))
d_post$time <- "November/December"

d <- d_pre %>% bind_rows(d_post)

d$knowq <- str_replace(d$knowq,"_pre|_post","")

d$knowq[d$knowq=='kn_masks']<-'Mandatory Masks in Public'
d$knowq[d$knowq=='kn_business']<-'Close Non-Essential Businesses'
d$knowq[d$knowq=='kn_who']<-'WHO Membership'
d$knowq <- factor(d$knowq,levels = c('Mandatory Masks in Public',
                                   'Close Non-Essential Businesses','WHO Membership'))

d <- d %>% mutate(y=percent+3,percent_lab=str_c(round(percent),"%")) 
d$know <- factor(d$know,levels=c("B>T","B=T","T>B"))

d$knowq <- factor(d$knowq,levels=c("Mandatory Masks in Public","Close Non-Essential Businesses","WHO Membership"))
b <-ggplot(d,aes(x=know,y=percent,fill=time)) + scale_fill_grey(name="Wave",start=0.7,end=0.3) +
  geom_bar(stat="identity",position="dodge") +  facet_wrap(vars(knowq), nrow = 1)+xlab("") +  ylab("")+ 
  theme(text = element_text(size=9.75),legend.position = "bottom",legend.margin=margin(c(1,1,1,1)))+
  geom_text(mapping=aes(know,y=y,label=percent_lab,group=time),size=3,position = position_dodge(width = .9)) + 
 ggtitle("(b) Relative Learning Measure: Perceptions of Trump's and Biden's Relative Positions")+
  theme(plot.title = element_text(size=10))
grid.arrange(a,b, nrow=2)
```

The campaign, therefore, only partially fulfilled one of its key roles in democracy: informing voters about facts central to their evaluation of the candidates. Many Trump voters (and voters more generally) disagreed with Trump on masks, held generally stable views on this issue, and didn't realize Trump disagreed with them. Although a plurality of Trump voters agreed with him on closing nonessential businesses and the WHO, Trump was broadly out of line with his supporters on mandatory masks, the amount of effort the government should place on testing, making people stay home, and protecting the public from the virus. Although some did learn, ultimately only about 40% of initial Trump voters who wanted tough Covid policies reported that Biden was tougher on Covid than Trump.

Since few learned Trump's and Biden's stances, we are unfortunately underpowered to study the consequences. Nonetheless, since politicians rarely step out of line with their own voters on such a salient issue, we think it's worth examining how voters handled learning about this key fact. So, did voters who learned Biden was tougher on Covid than Trump abandon Trump? We examine this with changes in vote choice and candidate ratings. In general, we find that the answer is not much. That's consistent with not much vote changing in our panel or in polls during this period. Table \@ref(tab:vote-changes) shows changes between initial vote intentions and vote choices reported after the election. `r Words(sum(dat$vote_post_tot[dat$vote_pre=="Trump"]=="Biden",na.rm=T))` of the `r sum(dat$vote_pre=="Trump",na.rm=T)` initial Trump voters switched to Biden, `r words(sum(dat$vote_post_tot[dat$vote_pre=="Trump"]=="Other"|dat$vote_post_tot[dat$vote_pre=="Trump"]=="No response",na.rm=T))` changed to "Other" or skipped the question, and `r words(sum(dat$vote_post_tot[dat$vote_pre=="Trump"]=="No vote",na.rm=T))` decided not to vote. Moreover, relative candidate ratings (difference between ratings of Biden and Trump) barely changed. The mean change in relative ratings was `r round(mean(dat$trumpbiden_change[dat$vote_pre=="Biden"],na.rm=T),2)` for Biden voters and `r round(mean(dat$trumpbiden_change[dat$vote_pre=="Trump"],na.rm=T),2)` for Trump voters. Relative candidate ratings are scaled from -1 (most pro-Biden/anti-Trump) to +1 (most anti-Biden/pro-Trump). Of course, in a close election, even small changes can be decisive.
<!-- [^133]: As noted, we do see politicians out of step with their voters on some issues. Republicans and gun control is one example. However, such issues do not have the same importance for nearly all voters that Covid did in 2020. -->

Figure \@ref(fig:punished) shows the percentage of initial Trump voters who disagreed with him and shifted their vote (top) or relative candidate ratings (bottom) away from him by whether they learned according to the relative learning measure. The bottom plot includes a violin plot showing the distribution of changes in relative candidate ratings along with a line segment indicating the mean for each learning-issue combination. It also includes the percentage in each subset who shifted away from Trump by lowering their relative candidate ratings (i.e., becoming less supportive of Trump relative to Biden).

(ref:vote-lab) This table shows the percentage of respondents who indicated an intention to vote for the candidates in columns who ended up voting for each candidate in the rows. Note that we place respondents who selected 'No response' in the 'Other' category.

```{r vote-changes,cache=TRUE}
dat$Pre <- factor(dat$vote_pre,levels=c("Biden","Trump","Other","No vote"))
dat$Pre[which(is.na(dat$Pre))] <- "Other"
dat$Post <- factor(dat$vote_post_tot,levels=c("Biden","Trump","Other","No vote","No response"))
dat$Post[which(dat$Post=="No response")] <- "Other"
dat$Post <- droplevels(dat$Post)
opts <- options(knitr.kable.NA = "")
dat %>% tabyl(Post,Pre) %>% adorn_totals(c("row","col")) %>% adorn_percentages("col") %>%  
  adorn_pct_formatting(digits = 1) %>% adorn_ns() %>%  adorn_title("combined") %>% 
  kable("latex", booktabs = T,caption="Vote Shifts between Pre-Election (August) and Post-Election Interviews") %>%
  kable_styling(position = "center",latex_options = "HOLD_position") %>% footnote(footnote_as_chunk = TRUE, threeparttable = TRUE,general="(ref:vote-lab)")
```

The figure shows that 5% to 21% of learners across the three issues moved away from Trump by shifting their vote away from him and 24% to 26% did so with candidate ratings (see the regressions below for confidence intervals). The figure compares these respondents to those who never learned. These never learners provide a nice counterfactual as they resembled the learners in August: they both did not place Biden as tougher than Trump on Covid in August. Interestingly, there's not much sign that the learners abandoned Trump at higher rates than individuals who did not learn, suggesting that learning the stances on each issue may not drive much of the movement away from Trump we do observe in this figure. In fact, only on the masks issue did Trump voters who learned the candidates' positions abandon him more than those who did not. Section \@ref(disagree-both) shows similar learning and the absence of vote/relative-ratings shifts for Trump voters who maintained their support for aggressive Covid policies in the November wave, and Figure \@ref(fig:punishedBiden) shows this plot for initial Biden voters. 

```{r punished, fig.height=9,fig.width=8,echo=FALSE, message = F, warning = F, include = T, cache = T, fig.cap="Shifting away from Trump among initial Trump voters who disagreed with him on Covid policies by whether they learned the candidates' relative positions. The top panels show bar charts with percentages of initial Trump supporters who did not vote for him. The bottom panels show violin plots of the distributions of changes in relative candidate ratings with line segments indicating means. It also includes percentages in each category whose changes in relative ratings were negative (i.e., who moved away from Trump). The plots show that between five and 26\\% of learners abandoned Trump, although shifting from him is not always greater among learners, suggesting that it is not only due to learning policy stances."}

d1 <- dat %>% filter(vote_pre=="Trump" & !is.na(punished_vote) & 
                       maskspublic_you_pre=="Agree") %>% # excludes all but people who disagree with trump
  group_by(maskspublic_cand_pre,maskspublic_cand_post) %>% summarise(n=n(),percent=100*mean(vote_post!="Trump")) 
d1$q <- "Mandatory Masks in Public"

d2 <- dat %>% filter(vote_pre=="Trump" & !is.na(punished_vote) & 
                       closebusiness_you_pre=="Agree") %>% 
  group_by(closebusiness_cand_pre,closebusiness_cand_post)%>% summarise(n=n(),percent=100*mean(vote_post!="Trump")) 
d2$q <- "Close Non-Essential Businesses"

d3 <- dat %>% filter(vote_pre=="Trump" & !is.na(punished_vote) & 
                       who_you_pre=="Agree") %>% group_by(who_cand_pre,who_cand_post) %>%
  summarise(n=n(),percent=100*mean(vote_post!="Trump")) 
d3$q <- "WHO Membership"

d1<-rename(d1,pre=maskspublic_cand_pre,post=maskspublic_cand_post);
d2<-rename(d2,pre=closebusiness_cand_pre,post=closebusiness_cand_post);
d3<-rename(d3,pre= who_cand_pre,post=who_cand_post)
d<-bind_rows(d1,d2,d3)
d$learned <- factor(
  paste(d$pre, d$post),
  levels = c("0 0", "0 1", "1 0", "1 1"),
  labels = c("Never Learned", "Learned", "Forgot/Projected", "Always Knew")
)
d <- d %>% filter(learned %in% c("Never Learned","Learned"))
d <- d %>% group_by(learned,q) %>% mutate(y=percent+1) 
d$percent_label <- str_c(round(d$percent),"%")
d$learned <- factor(d$learned,levels=c("Learned","Never Learned"))
a<-ggplot(d,aes(x=learned,y=percent)) + 
  geom_bar(stat="identity") +
  facet_wrap(~fct_relevel(q,c("Mandatory Masks in Public","Close Non-Essential Businesses","WHO Membership")), 
             nrow = 1)+xlab("") + ylab("Percent did not vote for Trump") + 
  theme(legend.position = "bottom",legend.margin=margin(c(1,1,1,1))) + 
  theme(axis.text.x = element_text(angle = 20, vjust = .5)) +
  geom_text(mapping=aes(learned,y,label=percent_label),colour="black") +
  ggtitle("(a) Shifting away from Trump by not voting for him") + theme(plot.title = element_text(size=10))


#punished ratings
d1<-rename(dat,pre=maskspublic_cand_pre,post=maskspublic_cand_post);
d2<-rename(dat,pre=closebusiness_cand_pre,post=closebusiness_cand_post);
d3<-rename(dat,pre= who_cand_pre,post=who_cand_post)

masks <- d1 %>% filter(vote_pre=="Trump" & maskspublic_you_pre=="Agree") %>% 
  dplyr::select(trumpbiden_change,pre,post) %>% 
  mutate(q="Mandatory Masks in Public")
business <- d2 %>% filter(vote_pre=="Trump" &  closebusiness_you_pre=="Agree") %>% 
  dplyr::select(trumpbiden_change,pre,post) %>% 
  mutate(q="Close Non-Essential Businesses")
who <- d3 %>% filter(vote_pre=="Trump" & who_you_pre=="Agree") %>% 
  dplyr::select(trumpbiden_change,pre,post) %>% 
   mutate(q="WHO Membership")

long <- masks %>% bind_rows(business,who) %>%
  drop_na()
long$learned <- factor(
  paste(long$pre, long$post),
  levels = c("0 0", "0 1", "1 0", "1 1"),
  labels = c("Never Learned", "Learned", "Forgot/Projected", "Always Knew")
)

long <- long %>% filter(learned %in% c("Learned","Never Learned"))
long$learned <- droplevels(long$learned)
long$learned <- factor(long$learned,levels=c("Learned","Never Learned"))

labs <- long %>% group_by(learned,q) %>% summarise(punished=mean(trumpbiden_change<0),rewarded=mean(trumpbiden_change>0)) %>% 
  mutate(label=str_c(round(punished*100),"%")) %>% mutate(percent=round(punished*100-rewarded*100))


b<-ggplot(long, aes(learned,trumpbiden_change)) + geom_violin(scale='width') + 
  stat_summary(fun = "mean",geom = "crossbar",width = 0.75,colour="darkgrey") + 
  facet_wrap(~fct_relevel(q,c("Mandatory Masks in Public","Close Non-Essential Businesses","WHO Membership"))) +
   xlab("") + ylab("Change in Trump minus Biden Ratings") + 
  geom_label(data=labs,aes(learned,-0.75,label=label)) + 
    theme(axis.text.x = element_text(angle = 20, vjust = .5)) +
  ggtitle("(a) Shifting away from Trump by lowering relative candidate ratings") + theme(plot.title = element_text(size=10))

grid.arrange(a,b,nrow=2)

```

<!-- Furthermore, when we consider that some Trump voters who disagreed with him actually moved their relative candidate ratings in a pro-Trump direction, the data provide even less evidence for punishment. When we subtract the percentages who became more positive about Trump from the percentages who became more negative about him, we find net punishment of `r words(round(labs$percent[2]))` percent for masks,  `r words(round(labs$percent[1]))` percent for closing businesses, and `r round(labs$percent[3])` percent for the WHO. --> 

```{r leadbyissuereglearningTrumpPrep,echo=FALSE,cache=F,results='asis',message=FALSE,warning=FALSE,include=T}

dat$learneddum2_masks <- ifelse(dat$maskspublic_cand_pre==0& 
                                     dat$maskspublic_cand_post==1,1,0) 
dat$learneddum2_closebusiness<-ifelse(dat$closebusiness_cand_pre==0&
                                        dat$closebusiness_cand_post==1,1,0) 
dat$learneddum2_who <- ifelse(dat$who_cand_pre==0&dat$who_cand_post==1,1,0) 

#Data for regressions
dreg <- dat  %>%   filter(vote_pre=="Trump") %>%  
  dplyr::select(vote_trump_postp5,vote_trump_prep5,maskspublic_cand_pre,maskspublic_cand_post,
                closebusiness_cand_pre,closebusiness_cand_post,
                who_cand_pre,who_cand_post,
                learneddum2_masks,learneddum2_closebusiness,learneddum2_who,
                maskspublic_you2_post,closebusiness_you2_post,who_you2_post,
                maskspublic_you2_pre,closebusiness_you2_pre,who_you2_pre)
# Calculate the number of people who learned about each policy
num_learned_masks <- sum(dreg$learneddum2_masks, na.rm = TRUE)
num_learned_closebusiness <- sum(dreg$learneddum2_closebusiness, na.rm = TRUE)
num_learned_who <- sum(dreg$learneddum2_who, na.rm = TRUE)
```

These figures provide a simple presentation of the findings, but have limitations. They don't compare initial Trump voters who agreed with the Covid policies to initial Trump voters who disagreed or said neither agree nor disagree. They also don't provide estimates of uncertainty. To provide these, we estimate simple regression models, one for each of the three Covid policies. In each one, we examine whether initial Trump voters who initially disagreed with him and learned about it defected from Trump by November. We compare these respondents to individuals who neither agreed nor disagreed with each policy and with those who never learned (since these provide a nice counterfactual). For each policy, we regress November vote on an indicator for whether they learned the candidate stances on each of these issues (0/1, relative measure), their attitude on each respective issue in August, and the interaction. We code the vote variable Biden 0, 0.5 Other/No vote, and Trump 1 (other codings produce similar results). The number who learned on the three Covid issues was `r num_learned_masks`, `r num_learned_closebusiness`, and `r num_learned_who`, respectively. The key test is the interaction between the respective Covid policy view and learning Biden supported the policy more than did Trump (B>T). This interaction tells us whether Covid views led to greater defections from Trump among learners compared to non-learners. In line with the figures, these regression estimates suggest little sign that Covid views hurt Trump among the learners (see Table \@ref(tab:leadbyissuereglearningTrump)). In these simple regression models, August views on mandatory masks, closing nonessential businesses, and WHO membership are all predictive of shifting against Trump (the main effects are negative). But the key interaction is incorrectly signed (it's positive but should be negative) for all three policies and imprecisely estimated. So, if anything, learning Biden was tougher than Trump on these policies led initial Trump voters to be less likely to defect than non-learners. 

(ref:regressiontable1footnote) Each column shows a separate least-squares regression with 95% confidence intervals in parentheses. This table shows the results of separately regressing November vote on an indicator for whether they learned the candidate stances on each of these issues (0/1, relative measure), their attitude on  each respective issue in August, and the interaction. Trump vote coded Biden 0, 0.5 Other/No vote, and Trump 1. All variables coded 0-1. The number of observations varies across the regressions because the number of respondents who don't know the stances in August varies. 

```{r leadbyissuereglearningTrump,echo=FALSE,cache=F,results='asis',message=FALSE,warning=FALSE,include=T}

dat$learneddum2_masks <- ifelse(dat$maskspublic_cand_pre==0& 
                                     dat$maskspublic_cand_post==1,1,0) 
dat$learneddum2_closebusiness<-ifelse(dat$closebusiness_cand_pre==0&
                                        dat$closebusiness_cand_post==1,1,0) 
dat$learneddum2_who <- ifelse(dat$who_cand_pre==0&dat$who_cand_post==1,1,0) 

#Data for regressions
dreg <- dat  %>%   filter(vote_pre=="Trump") %>%  
  dplyr::select(vote_trump_postp5,vote_trump_prep5,maskspublic_cand_pre,maskspublic_cand_post,
                closebusiness_cand_pre,closebusiness_cand_post,
                who_cand_pre,who_cand_post,
                learneddum2_masks,learneddum2_closebusiness,learneddum2_who,
                maskspublic_you2_post,closebusiness_you2_post,who_you2_post,
                maskspublic_you2_pre,closebusiness_you2_pre,who_you2_pre)
# Calculate the number of people who learned about each policy
num_learned_masks <- sum(dreg$learneddum2_masks, na.rm = TRUE)
num_learned_closebusiness <- sum(dreg$learneddum2_closebusiness, na.rm = TRUE)
num_learned_who <- sum(dreg$learneddum2_who, na.rm = TRUE)

models <- list(
  "Mandatory Masks"     
  = lm(vote_trump_postp5~learneddum2_masks*maskspublic_you2_pre+learneddum2_masks*vote_trump_prep5,
               data = subset(dreg,maskspublic_cand_pre==0&maskspublic_cand_post==1|
                  maskspublic_cand_pre==0&maskspublic_cand_post==0) ),
  "Close Businesses"     
  = lm(vote_trump_postp5~learneddum2_closebusiness*closebusiness_you2_pre+learneddum2_closebusiness*vote_trump_prep5,
               data = subset(dreg,closebusiness_cand_pre==0&closebusiness_cand_post==1|
                  closebusiness_cand_pre==0&closebusiness_cand_post==0)),
  "WHO Membership"     
  = lm(vote_trump_postp5~learneddum2_who*who_you2_pre+learneddum2_who*vote_trump_prep5,
               data = subset(dreg,who_cand_pre==0&who_cand_post==1|
                  who_cand_pre==0&who_cand_post==0))
)

cap = "Learning and Voting on Three Coronavirus Policy Issues---Initial Trump Voters---Comparison to Those Who Never Learn" 
modelsummary(models,gof_omit="BIC|AIC|F|Log.Lik.|RMSE|R2 Adj.|Std.Errors",output = 'kableExtra',stars = F,statistic = 'conf.int', title = cap, vcov = "HC3",coef_rename = c("learneddum2_masks" = "Learned Stance on the Policy", 
                             "learneddum2_closebusiness" = "Learned Stance on the Covid Policy",
                             "learneddum2_who" = "Learned Stance on the Covid Policy",
                             "vote_trump_prep5" = "Lagged DV", 
           "learneddum2_masks:maskspublic_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_closebusiness:closebusiness_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_who:who_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_masks:vote_trump_prep5"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_closebusiness:vote_trump_prep5"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_who:vote_trump_prep5"="Learned Stance on the Policy X Lagged DV",
                             "maskspublic_you2_pre" = "Support for Covid Policy Pre",
                             "closebusiness_you2_pre" = "Support for Covid Policy Pre",
                             "who_you2_pre" = "Support for Covid Policy Pre") )  %>%
  footnote("(ref:regressiontable1footnote)",
    footnote_as_chunk = T ,
    escape = F, threeparttable = TRUE
   ) %>% 
    add_header_above(c(" " = 1, "DV: Vote for Trump Post"=3)) %>% 
  kable_styling(font_size = 9,latex_options="HOLD_position")
```

```{r leadbyissuereglearningprep, echo=FALSE, message=FALSE, warning=FALSE, cache=FALSE, include=T, results='asis'}

dat$learneddum2_masks <- ifelse(dat$maskspublic_cand_pre==0& 
                                     dat$maskspublic_cand_post==1,1,0) 
dat$learneddum2_closebusiness<-ifelse(dat$closebusiness_cand_pre==0&
                                        dat$closebusiness_cand_post==1,1,0) 
dat$learneddum2_who <- ifelse(dat$who_cand_pre==0&dat$who_cand_post==1,1,0) 

#Data for regressions
dreg <- dat  %>% 
  dplyr::select(vote_trump_postp5,vote_trump_prep5,maskspublic_cand_pre,maskspublic_cand_post,
                closebusiness_cand_pre,closebusiness_cand_post,
                who_cand_pre,who_cand_post,
                learneddum2_masks,learneddum2_closebusiness,learneddum2_who,
                maskspublic_you2_post,closebusiness_you2_post,who_you2_post,
                maskspublic_you2_pre,closebusiness_you2_pre,who_you2_pre)
# Calculate the number of people who learned about each policy
num_learned_masks <- sum(dreg$learneddum2_masks, na.rm = TRUE)
num_learned_closebusiness <- sum(dreg$learneddum2_closebusiness, na.rm = TRUE)
num_learned_who <- sum(dreg$learneddum2_who, na.rm = TRUE)
```

So far, we have focused on whether, when initial Trump voters realized they were out-of-step with him on Covid, they defected from him. There is, however, another set of voters who should be influenced by learning Trump's and Biden's stances. Covid should also have hurt Trump by deterring voters who might have otherwise shifted towards him. For example, an initial Biden voter who might've defected to Trump because of Trump's stances on immigration may not have done so when she learned about Trump's Covid stance. To incorporate such individuals, we therefore expand the regression analysis to respondents who initially planned to vote for Biden, didn't plan on voting, or planned to vote for some other candidate. To make this a model of vote change, we control for prior vote intent (the lagged dependent variable), which flexibly allows for regression to the mean (the results are similar if we difference the dependent variable instead). We also include the interaction between the learning indicators and the lagged dependent variable to allow for a more flexible specification (but again excluding this interaction leaves the results unchanged). The number who learned among all respondents on the three issues was `r num_learned_masks`, `r num_learned_closebusiness`, and `r num_learned_who`, respectively. Table \@ref(tab:leadbyissuereglearning) presents the estimates. Compared to the analysis among initial Trump voters, the 95% confidence intervals are smaller, and the estimates are more stable, but overall they are broadly similar. Among respondents who didn't learn, we again see a negative relationship between Covid policy views and changes in voting decisions across the three models (main effect of policy views). Once again, however, we fail to find that learning about the inconsistency leads individuals to shift away from Trump (or not shift towards him when they otherwise would). The interaction between policy views and learning is close to zero and inconsistently signed across the three policy issues.

(ref:regressiontable2footnote) Each column shows a separate least-squares regression with 95% confidence intervals in parentheses. This table shows the results of separately regressing November vote on August vote intent (the lagged dependent variable), an indicator variable for whether they learned the candidate stances on each of these issues (0/1, relative measure), their attitude on  each respective issue in August, and the relevant interactions. Trump vote coded Biden 0, 0.5 Other/No vote, and Trump 1. All variables coded 0-1. The number of observations varies across the regressions because the number of respondents who don't know the stances in August varies. 

```{r leadbyissuereglearning, echo=FALSE, message=FALSE, warning=FALSE, cache=FALSE, include=T, results='asis'}

dat$learneddum2_masks <- ifelse(dat$maskspublic_cand_pre==0& 
                                     dat$maskspublic_cand_post==1,1,0) 
dat$learneddum2_closebusiness<-ifelse(dat$closebusiness_cand_pre==0&
                                        dat$closebusiness_cand_post==1,1,0) 
dat$learneddum2_who <- ifelse(dat$who_cand_pre==0&dat$who_cand_post==1,1,0) 

#Data for regressions
dreg <- dat  %>% 
  dplyr::select(vote_trump_postp5,vote_trump_prep5,maskspublic_cand_pre,maskspublic_cand_post,
                closebusiness_cand_pre,closebusiness_cand_post,
                who_cand_pre,who_cand_post,
                learneddum2_masks,learneddum2_closebusiness,learneddum2_who,
                maskspublic_you2_post,closebusiness_you2_post,who_you2_post,
                maskspublic_you2_pre,closebusiness_you2_pre,who_you2_pre)

models <- list(
  "Mandatory Masks"     
  = lm(vote_trump_postp5~learneddum2_masks*maskspublic_you2_pre+learneddum2_masks*vote_trump_prep5,
               data = subset(dreg,maskspublic_cand_pre==0&maskspublic_cand_post==1|
                  maskspublic_cand_pre==0&maskspublic_cand_post==0) ),
  "Close Businesses"     
  = lm(vote_trump_postp5~learneddum2_closebusiness*closebusiness_you2_pre+learneddum2_closebusiness*vote_trump_prep5,
               data = subset(dreg,closebusiness_cand_pre==0&closebusiness_cand_post==1|
                  closebusiness_cand_pre==0&closebusiness_cand_post==0)),
  "WHO Membership"     
  = lm(vote_trump_postp5~learneddum2_who*who_you2_pre+learneddum2_who*vote_trump_prep5,
               data = subset(dreg,who_cand_pre==0&who_cand_post==1|
                  who_cand_pre==0&who_cand_post==0))
)
cap = "Learning and Voting on Three Coronavirus Policy Issues---All Respondents---Comparison to Those Who Never Learn" 
modelsummary(models,gof_omit="BIC|AIC|F|Log.Lik.|RMSE|R2 Adj.|Std.Errors",output = 'kableExtra',stars = F,statistic = 'conf.int', title = cap, vcov = "HC3",coef_rename = c("learneddum2_masks" = "Learned Stance on the Covid Policy", 
                             "learneddum2_closebusiness" = "Learned Stance on the Covid Policy",
                             "learneddum2_who" = "Learned Stance on the Covid Policy",
                             "vote_trump_prep5" = "Lagged DV", 
           "learneddum2_masks:maskspublic_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_closebusiness:closebusiness_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_who:who_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_masks:vote_trump_prep5"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_closebusiness:vote_trump_prep5"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_who:vote_trump_prep5"="Learned Stance on the Policy X Lagged DV",
                             "maskspublic_you2_pre" = "Support for Covid Policy Pre",
                             "closebusiness_you2_pre" = "Support for Covid Policy Pre",
                             "who_you2_pre" = "Support for Covid Policy Pre") )  %>%
  footnote("(ref:regressiontable2footnote)",
    footnote_as_chunk = T ,
    escape = F, threeparttable = TRUE
  )  %>% 
    add_header_above(c(" " = 1, "DV: Vote for Trump Post"=3)) %>% 
  kable_styling(font_size = 9,latex_options="HOLD_position")
masklearnb <- models$`Mandatory Masks`$coefficients["learneddum2_masks:maskspublic_you2_pre"]
masklearnse <- coef(summary(models$`Mandatory Masks`))["learneddum2_masks:maskspublic_you2_pre", "Std. Error"]

```

We have presented simple models, but the findings appear robust to a wide variety of other specifications. For example, they hold up when we control for partisan identification and views on abortion, aid to Blacks, the environment, health care, immigration, and redistribution (all wave 1 using multi-item scales for each policy, see Tables \@ref(tab:issues)-\@ref(tab:issues-spending) for question wording and Table \@ref(tab:policy-alpha) for details on scale construction). The standard errors drop a tad in these models, but the estimates remain similar (see Tables \@ref(tab:leadbyissuereglearningTrumpcontrols) and \@ref(tab:leadbyissuereglearningcontrols)). They hold when we measure candidate support, not with votes, but with relative ratings of Trump and Biden. Voters may be more willing to shift their ratings of these candidates than their votes for them, so ratings may be more sensitive to signs of defection. When we estimate similar models with candidate ratings instead of vote choice, however, we continue to find no sign that learning Trump was out-of-step mattered (see Tables \@ref(tab:leadbyissuereglearningTrumpRatings)-\@ref(tab:leadbyissuereglearningcontrolsRatings)). They hold when we compare learners, not only to those who never learn, but also to all other respondents (see Table \@ref(tab:leadbyissuereglearningAllcontrols)). They hold when we address concerns about measurement error using a multi-item scale with the six-covid policy items (see Figures \@ref(fig:regTrumpDisa) and \@ref(fig:reg)). Finally, these appendix figures show that the results hold with the more generous right-direction learning measure, among all respondents (not just learners), among moderate respondents, and among respondents who passed additional attention checks.[^705]  

[^705]: These analyses suggest that Covid views may have led to Trump defections among those who experienced a positive test by wave 2, though the estimates are imprecise.

The estimates are imprecise so it's important to explore how large of a Covid learning effect we can rule out. Consider the apparent learning effect for mandatory masks (from Table \@ref(tab:leadbyissuereglearning), Column 1). The estimate is `r round(masklearnb,2)` (95% CI `r round(masklearnb-1.96*masklearnse,2)` to `r round(masklearnb+1.96*masklearnse,2)`). Compared to a respondent who said "neither agree nor disagree" (0.5) a respondent who said "agree" (1) would decrease her likelihood of voting for Trump by `r round(masklearnb*-.5,3)` between the August and the post-election interviews (compared to a non-learner).  The 95% confidence interval extends to `r round(masklearnb-1.96*masklearnse,2)`, so we can rule out an apparent effect larger (in absolute magnitude) than that with 95% confidence. For the  "neither agree nor disagree" to "agree" comparison, the bottom end of this confidence interval implies we can rule out a probability of shifting against Trump larger than `r round((masklearnb-1.96*masklearnse)*-.5,3)`. These calculations make clear that, while we would ideally be able to draw strong inferences about how the public reacted when they learned Trump was out-of-step relative to Biden, we are underpowered to do so. As we have noted already, however, we are underpowered precisely because only a small subset learned he was out-of-step. We therefore think the most important finding in the paper is the simple descriptive statistic of how few respondents learned.

Although we are underpowered, it's still worth returning to our (admittedly imprecise) estimates of the effect of learning Trump was out-of-step on vote changes and asking whether they are small or large. Given the extraordinary crisis, we think they are arguably small, though reasonable people may disagree. One benchmark is to compare them to the magnitude of the longstanding tendency of partisans to "come home" during campaigns and vote in line with their pre-existing partisanship, a pattern which also exists in our panel (see Table \@ref(tab:leadbyissuereglearningcontrols), Column 1). To do so, we compare respondents at the 20th and 80th percentiles on the seven-point partisan identification scale, roughly equivalent to the 0.5/1 comparison on the mask policy view. Using the same model would correspond with a `r round((.83-.16)*.18, 2)` shift on the 0-1 voting measure. So, the point estimate of the tendency to come home is larger than our best estimate of learning Trump was out-of-step (`r round((.83-.16)*.18, 2)` vs. `r round(masklearnb*-.5,3)`, both 20th-80th percentile shifts).



# Following?  {-}

We next consider whether voters who disagreed with their candidate put an end to that disagreement by changing their own position. In other words, we consider whether they followed their candidate. Some of those who disagreed with Trump and learned about this disagreement, we find, followed the leader by adopting Trump's stances on the coronavirus in the post-election wave. Interestingly, this is least true for mask mandates. Of the `r dat %>% filter(vote_pre=="Trump"&maskspublic_cand_pre==0&maskspublic_cand_post==1) %>% summarise(n())` August Trump voters who learned about the candidates' positions on masks, `r dat %>% filter(vote_pre=="Trump"&maskspublic_cand_pre==0&maskspublic_cand_post==1) %>% summarise((round(100*mean(maskspublic_you_pre=="Agree",na.rm=T))))`% thought the government should require masks in public in August and `r dat %>% filter(vote_pre=="Trump"&maskspublic_cand_pre==0&maskspublic_cand_post==1) %>% summarise(round(100*mean(maskspublic_you_post=="Agree",na.rm=T)))`% thought so after the election. On the other two Covid policies, however, following is evident: the equivalent percentages for the `r dat %>% filter(vote_pre=="Trump"&closebusiness_cand_pre==0&closebusiness_cand_post==1) %>% summarise(n())` Trump voters who learned on the close businesses question were `r dat %>% filter(vote_pre=="Trump"&closebusiness_cand_pre==0&closebusiness_cand_post==1) %>% summarise(round(100*mean(closebusiness_you_pre=="Agree",na.rm=T)))`% and `r dat %>% filter(vote_pre=="Trump"&closebusiness_cand_pre==0&closebusiness_cand_post==1) %>% summarise(round(100*mean(closebusiness_you_post=="Agree",na.rm=T)))`%, and for the `r dat %>% filter(vote_pre=="Trump"&who_cand_pre==0&who_cand_post==1) %>% summarise(n())` August Trump voters who learned on the WHO these were `r dat %>% filter(vote_pre=="Trump"&who_cand_pre==0&who_cand_post==1) %>% summarise(round(100*mean(who_you_pre=="Agree",na.rm=T)))`%  and `r dat %>% filter(vote_pre=="Trump"&who_cand_pre==0&who_cand_post==1) %>% summarise(round(100*mean(who_you_post=="Agree",na.rm=T)))`% (relative placement learning measure).

These statistics do not account for regression to the mean: the tendency of respondents to move from more extreme positions towards the sample mean.  They also do not compare respondents who learned the candidates' positions to those who did not. To address these issues, Figure \@ref(fig:following) shows violin plots of the distributions of attitudes on each Covid policy from after the election among initial Trump voters. It separates attitudes by whether a respondent learned or never learned and by their attitude from the first wave. In that way, the plots control for prior attitudes and thus for regression to the mean. The plots also include horizontal line segments for the mean of each group. They show that, in each category, the mean is lower (i.e., less supportive of each policy) in the group that learned the candidates' positions compared to the group that never learned them. The distributions are also more concentrated at lower values among those who learned. 
(ref:following-lab) Following Trump on Covid? The figure shows violin plots of post-election policy attitudes among initial Trump voters by learning and August attitudes. The bars show the means. As in the analysis of voting, the figure compares those who learned Trump’s and Biden’s stances to those who never learned them using the relative learning measure.

```{r following,echo=FALSE,cache=T,message=FALSE,warning=FALSE,include=T,fig.cap="(ref:following-lab)"}
# Violin plots following
dat$learningcat_maskspublic <- NA
dat$learningcat_maskspublic[dat$maskspublic_cand_pre==0 & dat$maskspublic_cand_post==0] <- "Never Learned"
dat$learningcat_maskspublic[dat$maskspublic_cand_pre==0 & dat$maskspublic_cand_post==1] <- "Learned"
dat$learningcat_closebusiness <- NA
dat$learningcat_closebusiness[dat$closebusiness_cand_pre==0 & dat$closebusiness_cand_post==0] <- "Never Learned"
dat$learningcat_closebusiness[dat$closebusiness_cand_pre==0 & dat$closebusiness_cand_post==1] <- "Learned"
dat$learningcat_who <- NA
dat$learningcat_who[dat$who_cand_pre==0 & dat$who_cand_post==0] <- "Never Learned"
dat$learningcat_who[dat$who_cand_pre==0 & dat$who_cand_post==1] <- "Learned"
pre <- dat %>% filter(vote_pre=="Trump") %>% dplyr::select(maskspublic_you2_pre,closebusiness_you2_pre,who_you2_pre,rid_pre) %>% pivot_longer(cols=1:3,names_to="var",values_to="pre") %>% mutate(var=str_replace(var,"_you2_pre",""))
post <- dat %>% filter(vote_pre=="Trump") %>% dplyr::select(maskspublic_you2_post,closebusiness_you2_post,who_you2_post,rid_pre) %>% pivot_longer(cols=1:3,names_to="var",values_to="post") %>% mutate(var=str_replace(var,"_you2_post",""))
learning <- dat %>% filter(vote_pre=="Trump") %>% dplyr::select(learningcat_maskspublic,learningcat_closebusiness,learningcat_who,rid_pre) %>% pivot_longer(cols=1:3,names_to="var",values_to="learn") %>% mutate(var=str_replace(var,"learningcat_",""))                                                    

prefs <- pre %>% left_join(post,by=c("rid_pre","var"))
d <- prefs %>% left_join(learning,by=c("rid_pre","var"))
d$var <- as.factor(d$var)
levels(d$var) <- c("Close Non-Essential Businesses","Mandatory Masks in Public","WHO Membership")
d$var <- factor(d$var,levels=c("Mandatory Masks in Public","Close Non-Essential Businesses","WHO Membership"))
d$prel<-factor(x=d$pre,labels=c("Disagree","Neutral","Agree"))
d %>% filter(!is.na(learn) & !is.na(pre) & !is.na(post)) %>% 
  ggplot(aes(prel,post,color=learn,fill=learn)) + geom_violin(scale="width",alpha=0.5) + 
  facet_wrap(~var,nrow=3) + 
  scale_fill_grey(start=0.1,end=0.5,name="") + 
  scale_color_grey(start=0.1,end=0.5,name="") +
  stat_summary(position=position_dodge(),fun="mean",geom="crossbar",width=1) + 
  ylab("Attitudes After the Election") + xlab("Initial Attitude on the Respective Covid Policy")
```

To further assess following, we ran regressions of post-election views on policy views in the first wave (the lagged dependent variables), an indicator distinguishing learners, and the interaction between the relevant variables (see Table \@ref(tab:followingbyissuereglearning)). As before, we compare the learners to the those who never learn, since these two groups are comparable at baseline on the key variable: neither placed Biden as tougher than Trump on Covid.  The interaction between Trump vote and learning reveals evidence of following on each policy. On masks, the interaction implies that Trump voters who learned shift their policy view on masks by 0.237 on a 0-1 scale compared to Biden voters, a large effect. On closing nonessential businesses and the WHO, the estimates are 0.435 and 0.450, respectively. As with the vote regressions above, these estimates should not be interpreted as causal but as supporting a prediction from a causal account.

We can compare these to our estimates of policy views' effect on voting. Table \@ref(tab:leadbyissuereglearning) presented the most comparable regression estimates, which found that the interaction between policy views and learning was essentially zero (an imprecise zero). So, our best estimate is that the following effects are many times the leading-effects. 

It's possible that this following was relatively blind, but it's also possible that respondents who learned the stances are also learning information that shifted their views. Biden voters may have been hearing about the dangers of Covid, Trump supporters may have been hearing about restrictions failing to prevent the virus, such as from the Great Barrington Declaration.

These findings show another way Trump supporters reinforced their initial support for him rather than abandoning him. They also reassure us that the failure to find strong evidence that learning leads to changes in votes and relative candidate ratings is not an artifact of respondent inattention.

(ref:regressiontable3footnote) Each column shows a separate least-squares regression with 95% confidence intervals in parentheses. This table shows the results of separately regressing November attitudes on each of the three coronavirus policies on August attitudes on these policies (the lagged dependent variables), an indicator for whether they learned the candidate stances on these issues (0/1, relative measure), and the relevant interactions between these variables. The main effect of Trump vote and its interaction with learning reveal large learning-induced following effects. Trump vote coded Biden 0, 0.5 Other/No vote, and Trump 1. The number of observations varies across the regressions because the number of respondents who don't know the stances in August varies across the policies. 

```{r followingbyissuereglearning,echo=FALSE,cache=F,results='asis',message=FALSE,warning=FALSE,include=T}

dat$learneddum2_masks <- ifelse(dat$maskspublic_cand_pre==0& 
                                     dat$maskspublic_cand_post==1,1,0) 
dat$learneddum2_closebusiness<-ifelse(dat$closebusiness_cand_pre==0&
                                        dat$closebusiness_cand_post==1,1,0) 
dat$learneddum2_who <- ifelse(dat$who_cand_pre==0&dat$who_cand_post==1,1,0) 

#Data for regressions
dreg <- dat  %>% 
  dplyr::select(vote_trump_postp5,vote_trump_prep5,maskspublic_cand_pre,maskspublic_cand_post,
                closebusiness_cand_pre,closebusiness_cand_post,
                who_cand_pre,who_cand_post,
                learneddum2_masks,learneddum2_closebusiness,learneddum2_who,
                maskspublic_you2_post,closebusiness_you2_post,who_you2_post,
                maskspublic_you2_pre,closebusiness_you2_pre,who_you2_pre)

models <- list(
  "Mandatory Masks"     
  = lm(maskspublic_you2_post~learneddum2_masks*vote_trump_prep5+learneddum2_masks*maskspublic_you2_pre,
               data = subset(dreg,maskspublic_cand_pre==0&maskspublic_cand_post==1|
                  maskspublic_cand_pre==0&maskspublic_cand_post==0) ),
  "Close Businesses"     
  = lm(closebusiness_you2_post~learneddum2_closebusiness*vote_trump_prep5+learneddum2_closebusiness*closebusiness_you2_pre,
               data = subset(dreg,closebusiness_cand_pre==0&closebusiness_cand_post==1|
                  closebusiness_cand_pre==0&closebusiness_cand_post==0)),
  "WHO Membership"     
  = lm(who_you2_post~learneddum2_who*vote_trump_prep5+learneddum2_who*who_you2_pre,
               data = subset(dreg,who_cand_pre==0&who_cand_post==1|
                  who_cand_pre==0&who_cand_post==0))
)
cap = "Does Learning Lead to Following on Three Coronavirus Policy Issues---Comparison to Those Who Never Learn. " 
modelsummary(models,gof_omit="BIC|AIC|F|Log.Lik.|RMSE|R2 Adj.|Std.Errors",output = 'kableExtra',stars = F,escape = T,statistic = 'conf.int', title = cap, vcov = "HC3",
  coef_rename = c("learneddum2_masks" = "Learned Stance on the Policy", 
                             "learneddum2_closebusiness" = "Learned Stance on the Policy",
                             "learneddum2_who" = "Learned Stance on the Policy",
                             "vote_trump_prep5" = "Trump Vote Pre", 
                             "maskspublic_you2_pre" = "Lagged DV",
                             "closebusiness_you2_pre" = "Lagged DV",
                             "who_you2_pre" = "Lagged DV") )  %>%
  footnote("(ref:regressiontable3footnote)",
    footnote_as_chunk = T ,
    escape = F, threeparttable = TRUE
  )   %>% 
    add_header_above(c(" " = 1, "DV: Support for Covid Policy Post"=3)) %>% 
  kable_styling(font_size = 9,latex_options = c("HOLD_position", "threeparttable"))
```

\thispagestyle{empty}

# Conclusion  {-}

Studying whether voters select politicians on their policy stances is challenging. Politicians avoid unpopular stances on salient issues, limiting our opportunity to study policy accountability. Moreover, voters adopt the policy stances of their preferred candidate, making causation difficult to untangle. Experimental studies have yielded insights, but they don't reveal whether voters learn the key information they need to know in real world elections---i.e., they don't reveal whether voters learn that their preferred presidential candidate is out-of-step with them.

To overcome these hurdles, we take advantage of a unique situation: the incumbent presidential candidate in the 2020 US presidential election adopted unpopular stances on one of the most important crises in decades: the coronavirus pandemic. We ran a two-wave panel survey in which we asked about six coronavirus policy questions, on three of which we also asked respondents to place the candidates. 

We find that many of his voters in early August 2020 wanted a stronger response to the coronavirus, putting them at odds with Trump’s policies. On four out of six pandemic-related issues we surveyed, majorities of Trump supporters disagreed with him. Despite this, the percent who say Biden favored requiring masks more than Trump only increases by about 20  percentage points, and only reaches 40% at the end of the campaign (among Trump voters who supported requiring masks). Among those who updated their perceptions, we see no clear evidence of voters shifting away from Trump, though the sample size is too small for firm conclusions. Instead of abandoning Trump, they follow him, adopting his positions when they learn his stance. Although most Trump supporters did not penalize him for his unpopular Covid stance, the small fraction that did could have been influential given the election's narrow margin. These findings suggest that even in a crisis, many voters fail to recognize when they disagree with their candidate, or if they do, tend to stick with them rather than withdraw their support. These findings support previous research showing that policy voting is difficult for voters [@lenz2012]. However, they are also not inconsistent with work arguing that policy considerations can be influential [@fowler2020]. 

Although policy voting on the pandemic response may only have hurt Trump on the margins, Trump may have lost out on an approval bump that many other leaders received because he played down the pandemic. @sides2022bitter note that leaders of countries who took Covid seriously generally experienced sustained gains in approval ratings (148-50). A similar pattern, they report, held for US governors (150). Voters may therefore have lacked strong views about Covid policy, but did care about performance (or at least about the appearance of performance). In the eyes of many voters, Trump didn't take the pandemic seriously and so may have lost out on that performance reward from voters. Our findings are therefore inconsistent with the policy-view of voter selection, but consistent with a performance view.

Throughout the paper, we have attempted to address alternative explanations for the findings. Our key finding---that Trump voters disagreed with him on COVID and failed to learn they disagreed---cannot easily be explained away. It can't be easily dismissed by suggesting that voters saw Covid as unimportant or fleeting. As we report, survey data from 2020 suggest that they saw it as almost as threatening as nuclear war. Nor can it be dismissed because Trump's stance was too ambiguous. More than 90% of politically knowledgeable respondents saw Trump as less supportive of Covid measures than they saw Biden. Nor can it be dismissed because of the Lucid sample, an opt-in sample with well-documented respondent attention problems. Our survey closely replicated the actual election result, we excluded respondents failing initial checks, and conducted additional robustness tests with other attention measures.

Our conclusion that few voters shifted away from Trump because of Covid rests mainly on our descriptive findings about limited awareness of inconsistencies at the end of the campaign. But our imprecise observational finding about minimal vote shifting also withstands several alternative explanations. In particular, attitude instability cannot explain the failure to shift away from Trump. At this early stage of the pandemic, we found that the public held generally stable views, including initial Trump voters (although we find some movement among the small group of learners). Nor can it be easily explained by polarization. We find similarly small apparent effects of Covid policy attitudes when we limit the analysis to policy moderates, suggesting that polarization may not fully explain the results. Nevertheless, in addition to the standard problems with lagged panel analyses and observational research, there are reasons voters may have failed to abandon Trump that we lack the survey questions necessary to examine. For example, voters may have become frustrated with Covid restrictions, particularly those that affected their ability to make a living. They may have supported aggressive government responses that were not restrictive, such as subsidized testing, but feared Biden’s response would be too heavy-handed. Finally, it’s likely that voters who cared deeply about Covid would have already learned Trump’s and Biden’s stances by August. If so, they may have changed their votes accordingly before our first survey. Although some no doubt did so, the extent was limited. Trump remained popular enough to almost win the 2020 election despite public opinion—including among his own supporters—favoring greater government effort on Covid.

Why would Trump have stepped out of line not only with voters in general but his own voters in particular? Answers to this question can only be speculative, but one is that Trump thought he would win this election on the economy and worried that if he took the pandemic too seriously, he would harm it. He may have worried that, by wearing a mask, he would be signaling to voters that they should stay home, dampening consumer spending. He may have feared that government action on the virus would likewise scare voters, also dampening consumer spending. An alternative interpretation is that he thought the virus would hurt him and so attempted to shift it from a performance/valence issue to a policy issue. Once voters perceived there to be two sides, Trump supporters would take his side, dampening damage that might've been done from Covid deaths and other pandemic misery among his supporters.

One final issue to consider is whether Trump was so unusual a candidate as to make generalizing to other candidates impossible. While Trump does appear different from other candidates, scholars have pointed to similarities between Trump and leaders elsewhere [@levitsky2019; @norris2019]. Thus, even if our findings do not apply to all candidates everywhere, they may apply to an increasingly common category of candidate.

# Bibliography  {-}


<div id="refs"></div>

\clearpage
\beginsupplement
\singlespacing
\etocsetstyle{section}  \etocifnumbered{\etocnumber.\hspace{0.5em}}{}\etocname\nobreak\hfill \etocpage\nobreak\par
\pagenumbering{gobble} 
  
\newpage

# Online Appendix {-}

\etocignoretoctocdepth
\etocsettocstyle{\subsection*{\contentsname}}{}
\localtableofcontents

\newpage

\pagenumbering{arabic}

## Trump's Covid stance {#trump-stance}
@guntermann2021 examined why knowledge of Trump's Covid stances was low. They write: "Among the top 20% of respondents on this measure [non-Covid knowledge of candidate stances], those voting for Biden saw Biden as more pro-mask than Trump 96% of the time. In contrast, those voting for Trump did so only 63% of the time. People who did not support either candidate but had high knowledge did so 86% of the time. These findings are consistent with knowledgeable Trump voters engaging in motivated reasoning, projecting, or  cheerleading. Clearly, lack of knowledge is not the only problem."

**Summaries of news articles and Trump quotes on masks through Aug. 19**

April 7: "I don't think I'm going to be doing it. I think wearing a face mask as I greet presidents, prime ministers, dictators, kings, queens, I don't know. Somehow, I don't see it for myself," adding, "I just don't." The larger historical and political context of the President's remarks should be unpacked, but let's stop for a moment and reflect on the personal mindset Trump revealed with them. Under his watch, the pandemic is running out of control in the US. America has perhaps been among the worst in the world in its response, even as he demands praise and appreciation. As death, grief, and suffering pooled around him, Trump's thoughts turned to the optics of meeting people "sitting in the Oval Office behind that great resolute desk."
Who, in his right mind, would pause in the face of this pandemic to consider visiting dignitaries -- including dictators, mind you -- and how a medical mask might spoil his look?
Aside from anything else, we all know that foreign delegations won't be arriving at the White House any time soon. And if, by chance, it happened, the president should insist he be photographed wearing a mask if only to show his solidarity with and concern for others. (The first lady, perhaps less concerned about a mask messing her hair, encourages their use).\footnote{https://www.cnn.com/2020/04/07/opinions/trump-mask-coronavirus-dantonio/index.html} April 28: Despite CDC guidance that Americans should wear face masks in public to avoid spreading Covid-19, President Donald Trump joked about a man who wore one at the White House on Tuesday and Vice President Mike Pence refused to wear one while meeting doctors and patients at the Mayo Clinic in Minnesota. At one point, as Trump asked Ali Mills, the vice president of a family-owned contracting company from Pennsylvania to speak, he invited her husband and co-worker to join her on stage, and joked about the fact that he had worn a mask earlier. "Put that mask on, the way you had it," Trump said to the man. As the president shook his head and smiled, some in the room laughed. (After the event, Mills explained in an email that her husband, who "has a great passion for President Trump," has a Trump 2020 mask, which he showed the president before the event.)\footnote{https://theintercept.com/2020/04/28/trump-mocks-mans-mask-white-house-pence-refuses-wear-one-mayo-clinic/}May 27: Mr. Trump retweeted a post from Fox News political analyst Brit Hume showing a picture of Biden, the presumptive Democratic nominee, wearing sunglasses and a black mask that covered much of his face at a Memorial Day ceremony. "This might help explain why Trump doesn't like to wear a mask in public," Hume wrote.\footnote{https://www.cbsnews.com/news/trump-mocks-joe-biden-wear-face-mask-public/} June 28: "The mask is a double-edged sword," he told The Wall Street Journal. He explained they might make wearers "a little cocky" and neglect other public health guidelines, such as not touching their faces.\footnote{https://www.cnn.com/2020/06/28/politics/donald-trump-coronavirus-fallout/index.html} July 10: Miami-Dade mayor demands masks in public. But not for Trump\footnote{https://www.miamiherald.com/news/politics-government/article244135532.html} July 11: "I think when you're in a hospital, especially in that particular setting, where you're talking to a lot of soldiers and people that, in some cases, just got off the operating tables, I think it's a great thing to wear a mask." July 12: "I've never been against masks but I do believe they have a time and a place."\footnote{https://www.bbc.com/news/world-us-canada-53378439} July 16: Republican governors break from Trump amid growing calls for mask mandates . . . More and more, Republican politicians are mandating masks statewide, breaking from President Donald Trump who still resists the idea even though he finally wore one in public, once, last weekend. . . . President Trump's resistance trickles down to his supporters, Pepper says, and makes it harder for businesses to enforce mask rules. . . .  White House press secretary Kayleigh McEnany on Thursday rejected the idea of national mask mandate, saying, "We leave it to localities to make the decisions with regards to face coverings, and CDC guidelines remain the same today, recommended but not required."\footnote{https://abcnews.go.com/Politics/republican-governors-break-trump-amid-growing-calls-mask/story?id=71818051} July 16:  Speaking to Fox Business Network last week, Mr Trump said: "I'm all for mask" . . . The change of tone came as the US recorded 66,528 coronavirus cases on Saturday, a new daily record. But speaking to Fox News on Friday, Mr Trump said he didn't agree with a national mask mandate, saying people should have a "certain freedom". He also said he took issue with people touching their faces after taking their mask off. "They put their finger on the mask, and they take them off, and then they start touching their eyes and touching their nose and their mouth. And then they don't know how they caught it?" he said.\footnote{https://www.bbc.com/news/world-us-canada-53453468} July 17: Atlanta mayor: Trump broke city’s mask rule, ignored science. July 21: "It will probably, unfortunately, get worse before it gets better. Something I don’t like to say about things, but that’s the way it is. It’s what we have.’’ "I have no problem with masks. I view it this way: Anything that can potentially help, is a good thing. I have no problem. I carry it. I wear it. You saw me wearing it a number of times, and I’ll continue."\footnote{https://www.nytimes.com/2020/07/21/us/politics/trump-coronavirus-masks.html} July 29: Amid Virus Surge, Republicans Abruptly Urge Masks Despite Trump’s Resistance. Masks became a political cause for some in the early months of the pandemic. A growing set of Republican leaders are suddenly pushing Americans to wear them. . . . Protesters marched on the State Capitol in Texas, holding signs declaring that masks equal “medical tyranny.” Lawsuits filed in Florida courts argue that mask laws violate constitutional rights. President Trump mocked former Vice President Joseph R. Biden Jr. for wearing a mask and has rarely worn one himself.\footnote{https://www.nytimes.com/2020/07/01/us/coronavirus-masks.html} August 3: President Donald Trump on Monday sent a campaign email, typically used for soliciting donations, to make a different request of his supporters: consider wearing a mask. "We are all in this together, and while I know there has been some confusion surrounding the usage of face masks, I think it's something we should all try to do when we are not able to be socially distanced from others," the email, sent by the Trump campaign and signed by the President, read.\footnote{https://www.cnn.com/2020/08/03/politics/ trump-masks-campaign-email/index.html} August 13: Trump attacks Biden for calling on governors to mandate masks.\footnote{https://www.pressherald.com/2020/08/13/trump-attacks-biden-for-calling-on-governors-to-mandate-masks/} August 13: "We have urged Americans to wear masks. We’ve been saying wear them when it’s appropriate," Trump said. "Maybe they’re great and maybe they’re just good, maybe they’re not so good. But frankly what do you have to lose? You have nothing to lose." However, Trump claimed that Biden "wants to shut down our economy and close our schools and grind society to a halt."
"We’ll defeat this virus, but not by hiding in our basements, he’s got to come out of his basement. We’ll defeat this virus through a common sense mitigation effort, shielding those at highest risk and unleashing America’s medical and scientific genius."\footnote{https://www.cnbc.com/2020/08/13/trump-calls-bidens-coronavirus-plan-unscientific-rejects-call-for-national-mask-mandate.html}

## Analyses of Attrition {#analyses-attrition}
As with any study using panel data, we must be concerned about attrition. We address attrition in two ways. First, we consider how respondents to the first wave compare to respondents who made it to the second wave in Table \@ref(tab:attrition-table1) on the variables we use in our analyses. There are three clear differences: older respondents are more likely to participate in the second wave, respondents who knew more about the candidates' positions in the first wave were more likely to make it to the second wave, and those who were more personally affected by the virus were less likely to participate in the second wave. While we might expect the respondents who were more personally affected by the virus and did not participate in the second wave to have abandoned Trump more, we would also expect those who were older (because they are more at risk) and those who knew more about the candidates' positions to have shifted away from Trump more. Thus, attrition is not systematically related to variables we would expect to influence our results. 

Second, we can estimate regression models on the respondents who did complete our second wave interview and then, using only variables from the first wave, forecast how respondents would have behaved if they had taken our follow-up survey. We can then compare forecasts for those who did and did not take the follow-up survey. Of course, this exercise assumes the statistical models capture all the relevant variables, do so with the right functional form, and that none of these variables interact with attrition, all strong assumptions. Nevertheless, we think the exercise is useful. We first run models of learning, which include only wave one variables, and calculate predicted values for respondents who only participated in the first wave and for respondents who participated in both waves, allowing us to compare how likely each type of respondent is to learn. We then run models of knowledge of relative positions in the second wave. Finally, we run models of abandoning Trump, operationalized as voting against Trump or as lowering relative candidate ratings. All models include the partisanship as a social identity scale, the proportion of correct relative candidate placements on the 14 issues with those questions, dummy variables for whether the respondent or a family member had a positive Covid test prior to the first wave and for whether a family member died from the virus as well as demographic controls (age, gender, race, Hispanic ethnicity, education, household income, and unemployment).

Figure \@ref(fig:attrition-pred) shows that respondents who were reinterviewed are not systematically different on each variable from those who were not. They were slightly more likely to learn relative positions on masks and closing businesses, but slightly less likely to learn on the WHO. They were slightly more likely to know on each of the three issues. They were slightly less likely to vote against him, but slightly more likely to lower their relations. This analysis suggests we are thus are unlikely to be significantly underestimating or overestimating how much Trump supporters shifted away from him after he adopted his unpopular stance. 

```{r attrition-table1, results = 'asis', cache = T, echo = F, message = F, warning = F, include = T}
dat2 <- dat
load("Data/Cleaned/preelection.Rda")
dat$rid_pre <- dat$rid_pre_pre
dat$wave2 <- ifelse(dat$rid_pre %in% dat2$rid_pre,1,0) 

# Recode education
levels(dat$education_pre) <- c("No college","No college","No college","No college","College","Graduate","Graduate","Graduate")

t <- data.frame(matrix(ncol = 3, nrow = 27))
r <- 1; t[r, 1] <- "Sample"; t[r, 2] <- "First Wave"; t[r, 3] <- "Second Wave";
r <- r+2; t[r, 1] <- "N"; t[r, 2] <- format(nrow(dat),big.mark=","); 
                          t[r, 3] <- format(nrow(dat[dat$wave2==1,]),big.mark=",");
r <- r+1; t[r, 1] <- "Gender";
r <- r+1; t[r, 1] <- "Female";t[r, 2] <- round(mean(dat$gender_pre=="female",na.rm=T)*100,0);  
                              t[r, 3] <- round(mean(dat$gender_pre[dat$wave2==1]=="female",na.rm=T)*100,0);
r <- r+1; t[r, 1] <- "Age";
r <- r+1; t[r, 1] <- "18-24"; t[r, 2] <- round(mean(dat$age_pre >= 18 & dat$age_pre <= 24,na.rm=T)*100, 0); 
                              t[r, 3] <- round(mean(dat$age_pre[dat$wave2==1] >= 18 & dat$age_pre[dat$wave2==1] <= 24,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "25-34"; t[r, 2] <- round(mean(dat$age_pre >= 25 & dat$age_pre <= 34,na.rm=T)*100, 0); 
                              t[r, 3] <- round(mean(dat$age_pre[dat$wave2==1] >= 25 & dat$age_pre[dat$wave2==1] <= 34,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "35-49"; t[r, 2] <- round(mean(dat$age_pre >= 35 & dat$age_pre <= 49,na.rm=T)*100, 0); 
                              t[r, 3] <- round(mean(dat$age_pre[dat$wave2==1] >= 35 & dat$age_pre[dat$wave2==1] <= 49,na.rm=T)*100, 0);  
r <- r+1; t[r, 1] <- "50-64"; t[r, 2] <- round(mean(dat$age_pre >= 50 & dat$age_pre <= 64,na.rm=T)*100, 0); 
                              t[r, 3] <- round(mean(dat$age_pre[dat$wave2==1] >= 50 & dat$age_pre[dat$wave2==1] <= 64,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "65+";  t[r, 2] <- round(mean(dat$age_pre >= 65,na.rm=T)*100, 0);
                             t[r, 3] <- round(mean(dat$age_pre[dat$wave2==1] >= 65,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Race";
r <- r+1; t[r, 1] <- "Non-Hispanic White"; 
          t[r, 2] <- round(mean(dat$white_pre == 1,na.rm=T)*100, 0); 
          t[r, 3] <- round(mean(dat$white_pre[dat$wave2==1] == 1,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Black"; 
         t[r, 2] <- round(mean(dat$black_pre == 1,na.rm=T)*100, 0); 
         t[r, 3] <- round(mean(dat$black_pre[dat$wave2==1] == 1,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Asian + Other"; 
         t[r, 2] <- round(mean(dat$asian_pre[dat$wave2==1] == 1 | dat$other_pre[dat$wave2==1] == 1 | dat$native_pre[dat$wave2==1] == 1 | dat$hawaiian_pre[dat$wave2==1] == 1,na.rm=T)*100, 0); 
         t[r, 3] <- round(mean(dat$asian_pre[dat$wave2==1] == 1 | dat$other_pre[dat$wave2==1] == 1 | dat$native_pre[dat$wave2==1] == 1 | dat$hawaiian_pre[dat$wave2==1] == 1,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Hispanic"; 
         t[r, 2] <- round(mean(dat$hispanic_pre == "hispanic",na.rm=T)*100, 0); 
         t[r, 3] <- round(mean(dat$hispanic_pre[dat$wave2==1] == "hispanic",na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Education";
r <- r+1; t[r, 1] <- "No College"; 
         t[r, 2] <- round(mean(dat$education_pre == "No college",na.rm=T)*100, 0); 
         t[r, 3] <- round(mean(dat$education_pre[dat$wave2==1] == "No college",na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Bachelor's Degree"; 
         t[r, 2] <- round(mean(dat$education_pre == "College",na.rm=T)*100, 0); 
         t[r, 3] <- round(mean(dat$education_pre[dat$wave2==1] == "College",na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Graduate Degree"; 
         t[r, 2] <- round(mean(dat$education_pre == "Graduate",na.rm=T)*100, 0);
         t[r, 3] <- round(mean(dat$education_pre[dat$wave2==1] == "Graduate",na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Income";
r <- r+1; t[r, 1] <- "<$20k"; 
         t[r, 2] <- round(mean(dat$hhi_pre <= 2,na.rm=T)*100, 0); 
         t[r, 3] <- round(mean(dat$hhi_pre[dat$wave2==1] <= 2,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "$20k-$39k"; 
         t[r, 2] <- round(mean(dat$hhi_pre >= 3 & dat$hhi_pre <= 6,na.rm=T)*100, 0); 
         t[r, 3] <- round(mean(dat$hhi_pre[dat$wave2==1] >= 3 & dat$hhi_pre[dat$wave2==1] <= 6,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "$40k-$59k"; 
         t[r, 2] <- round(mean(dat$hhi_pre >= 7 & dat$hhi_pre <= 10,na.rm=T)*100, 0); 
         t[r, 3] <- round(mean(dat$hhi_pre[dat$wave2==1] >= 7 & dat$hhi_pre[dat$wave2==1] <= 10,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "$60k-$79k"; 
         t[r, 2] <- round(mean(dat$hhi_pre >= 11 & dat$hhi_pre <= 14,na.rm=T)*100, 0); 
         t[r, 3] <- round(mean(dat$hhi_pre[dat$wave2==1] >= 11 & dat$hhi_pre[dat$wave2==1] <= 14,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "$80k+"; 
         t[r, 2] <- round(mean(dat$hhi_pre >= 15,na.rm=T)*100, 0); 
         t[r, 3] <- round(mean(dat$hhi_pre[dat$wave2==1] >= 15,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Candidate Support Variables";
r <- r+1; t[r, 1] <- "Voted for Trump"; 
         t[r, 2] <- round(mean(dat$vote_pre=="Trump",na.rm=T)*100, 0); 
         t[r, 3] <- round(mean(dat$vote_pre[dat$wave2==1]=="Trump",na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Relative Candidate Ratings"; 
         t[r, 2] <- round(mean(dat$trumpbiden_pre,na.rm=T),1); 
         t[r, 3] <- round(mean(dat$trumpbiden_pre[dat$wave2==1],na.rm=T), 1);
r <- r+1; t[r, 1] <- "Coronavirus Variables"; 
r <- r+1; t[r, 1] <- "More or Much More Coronavirus Testing"; 
         t[r, 2] <- round(mean(dat$coronavirustesting_pre>0.5,na.rm=T)*100,0); 
         t[r, 3] <- round(mean(dat$coronavirustesting_pre[dat$wave2==1]>0.5,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "More or Much More to Make People Stay at Home"; 
         t[r, 2] <- round(mean(dat$stayathome_pre>0.5,na.rm=T)*100,0); 
         t[r, 3] <- round(mean(dat$stayathome_pre[dat$wave2==1]>0.5,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "More or Much More to Protect from the Coronavirus"; 
         t[r, 2] <- round(mean(dat$protectcoronavirus_pre>0.5,na.rm=T)*100,0); 
         t[r, 3] <- round(mean(dat$protectcoronavirus_pre[dat$wave2==1]>0.5,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Agree with Mandatory Masks in Public"; 
         t[r, 2] <- round(mean(dat$maskspublic_you_pre=="Agree",na.rm=T)*100,0); 
         t[r, 3] <- round(mean(dat$maskspublic_you_pre=="Agree",na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Agree with Closing Non-Essential Businesses"; 
         t[r, 2] <- round(mean(dat$closebusiness_you_pre=="Agree",na.rm=T)*100,0); 
         t[r, 3] <- round(mean(dat$closebusiness_you_pre=="Agree",na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Agree with WHO Membership"; 
         t[r, 2] <- round(mean(dat$who_you_pre=="Agree",na.rm=T)*100,0); 
         t[r, 3] <- round(mean(dat$who_you_pre=="Agree",na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Knew Candidate Positions on Mandatory Masks in Public"; 
         t[r, 2] <- round(mean(dat$maskspublic_cand_pre==1,na.rm=T)*100,0); 
         t[r, 3] <- round(mean(dat$maskspublic_cand_pre[dat$wave2==1]==1,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Knew Candidate Positions on Closing Non-Essential Businesses"; 
         t[r, 2] <- round(mean(dat$closebusiness_cand_pre==1,na.rm=T)*100,0); 
         t[r, 3] <- round(mean(dat$closebusiness_cand_pre[dat$wave2==1]==1,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Knew Candidate Positions on WHO Membership"; 
         t[r, 2] <- round(mean(dat$who_cand_pre==1,na.rm=T)*100,0); 
         t[r, 3] <- round(mean(dat$who_cand_pre[dat$wave2==1]==1,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Positive Covid Test (self, friend or family)"; 
         t[r, 2] <- round(mean(dat$coronavirus_test_pre==1,na.rm=T)*100,0); 
         t[r, 3] <- round(mean(dat$coronavirus_test_pre[dat$wave2==1]==1,na.rm=T)*100, 0);
r <- r+1; t[r, 1] <- "Covid Death (friend or family)"; 
         t[r, 2] <- round(mean(dat$coronavirus_died_pre==1,na.rm=T)*100,0); 
         t[r, 3] <- round(mean(dat$coronavirus_died_pre[dat$wave2==1]==1,na.rm=T)*100, 0);
options(knitr.kable.NA = '')
kable(t, format = "latex", booktabs = T, format.args = list(big.mark = ",", scientific = FALS,Etable.attr = "style='height:80%;'" ),
  col.names = c(" ","Panel Study","Benchmark"), caption = "Demographic Characteristics of Trump Voters in First and Second Waves", linesep = "") %>%
   row_spec(c(0,1,4,6,12,17,21,27,30),bold=TRUE) %>% 
  add_footnote("Note: Except for the N row, cell entries provide the percentage of first wave and second wave in each category.", notation = "none") %>% kable_styling(latex_options = "HOLD_position",font_size=7)
```

```{r attrition-pred,fig.height=8,echo=FALSE,cache=T,results='asis',message=FALSE,warning=FALSE,fig.cap="Distributions of predicted values from models of learning and shifting away from Trump among respondents who were reinterviewed and among those who were not"}

# Recode race in first wave so it is the same as in second wave
levels(dat$race_pre) <- c("Other", "Asian", "Black", "Other", "Other", 
                          "White")

mod1 <- lm(learneddum2_masks ~ pidsoc_rep_pre + candcorrect_pre + coronavirus_died_pre + coronavirus_test_pre + age_pre + gender_pre + race_pre + hispanic_pre + education_pre + hhi_pre + unemployed_pre,data=subset(dat2,vote_pre=="Trump" & maskspublic_you_pre=="Agree"))
mod2 <- lm(learneddum2_closebusiness ~ pidsoc_rep_pre + candcorrect_pre + coronavirus_died_pre + coronavirus_test_pre + age_pre + gender_pre + race_pre + hispanic_pre + education_pre + hhi_pre + unemployed_pre,data=subset(dat2,vote_pre=="Trump" & closebusiness_you_pre=="Agree"))
mod3 <- lm(learneddum2_who ~ pidsoc_rep_pre + candcorrect_pre + coronavirus_died_pre + coronavirus_test_pre + age_pre + gender_pre + race_pre + hispanic_pre + education_pre + hhi_pre + unemployed_pre,data=subset(dat2,vote_pre=="Trump" & who_you_pre=="Agree"))
mod4 <- lm(maskspublic_cand_post ~ pidsoc_rep_pre + candcorrect_pre + coronavirus_died_pre + coronavirus_test_pre + age_pre + gender_pre + race_pre + hispanic_pre + education_pre + hhi_pre + unemployed_pre,data=subset(dat2,vote_pre=="Trump" & maskspublic_you_pre=="Agree"))
mod5 <- lm(closebusiness_cand_post ~ pidsoc_rep_pre + candcorrect_pre + coronavirus_died_pre + coronavirus_test_pre + age_pre + gender_pre + race_pre + hispanic_pre + education_pre + hhi_pre + unemployed_pre,data=subset(dat2,vote_pre=="Trump" & closebusiness_you_pre=="Agree"))
mod6 <- lm(who_cand_post ~ pidsoc_rep_pre + candcorrect_pre + coronavirus_died_pre + coronavirus_test_pre + age_pre + gender_pre + race_pre + hispanic_pre + education_pre + hhi_pre + unemployed_pre,data=subset(dat2,vote_pre=="Trump" & who_you_pre=="Agree"))
mod7 <- lm(ifelse(vote_post_tot!="Trump",1,0) ~ pidsoc_rep_pre + candcorrect_pre + coronavirus_died_pre + coronavirus_test_pre + age_pre + gender_pre + race_pre + hispanic_pre + education_pre + hhi_pre + unemployed_pre,data=subset(dat2,vote_pre=="Trump" & maskspublic_you_pre=="Agree"))
mod8 <- lm(ifelse(punished=="Punished",1,0) ~ pidsoc_rep_pre + candcorrect_pre + coronavirus_died_pre + coronavirus_test_pre + age_pre + gender_pre + race_pre + hispanic_pre + education_pre + hhi_pre + unemployed_pre,data=subset(dat2,vote_pre=="Trump" & maskspublic_you_pre=="Agree"))

pred1_yes <- predict(mod1,newdata=dat[dat$wave2==1,])
pred1_no <- predict(mod1,newdata=dat[dat$wave2==0,])
pred2_yes <- predict(mod2,newdata=dat[dat$wave2==1,])
pred2_no <- predict(mod2,newdata=dat[dat$wave2==0,])
pred3_yes <- predict(mod3,newdata=dat[dat$wave2==1,])
pred3_no <- predict(mod3,newdata=dat[dat$wave2==0,])
pred4_yes <- predict(mod4,newdata=dat[dat$wave2==1,])
pred4_no <- predict(mod4,newdata=dat[dat$wave2==0,])
pred5_yes <- predict(mod5,newdata=dat[dat$wave2==1,])
pred5_no <- predict(mod5,newdata=dat[dat$wave2==0,])
pred6_yes <- predict(mod6,newdata=dat[dat$wave2==1,])
pred6_no <- predict(mod6,newdata=dat[dat$wave2==0,])
pred7_yes <- predict(mod7,newdata=dat[dat$wave2==1,])
pred7_no <- predict(mod7,newdata=dat[dat$wave2==0,])
pred8_yes <- predict(mod8,newdata=dat[dat$wave2==1,])
pred8_no <- predict(mod8,newdata=dat[dat$wave2==0,])
d1 <- tibble(pred=c(pred1_yes,pred1_no),reinterviewed=as.factor(c(rep("Yes",length(pred1_yes)),rep("No",length(pred1_no)))))

d2 <- tibble(pred=c(pred2_yes,pred2_no),reinterviewed=as.factor(c(rep("Yes",length(pred2_yes)),rep("No",length(pred2_no)))))

d3 <- tibble(pred=c(pred3_yes,pred3_no),reinterviewed=as.factor(c(rep("Yes",length(pred3_yes)),rep("No",length(pred3_no)))))

d4 <- tibble(pred=c(pred4_yes,pred4_no),reinterviewed=as.factor(c(rep("Yes",length(pred4_yes)),rep("No",length(pred4_no)))))

d5 <- tibble(pred=c(pred5_yes,pred5_no),reinterviewed=as.factor(c(rep("Yes",length(pred5_yes)),rep("No",length(pred5_no)))))

d6 <- tibble(pred=c(pred6_yes,pred6_no),reinterviewed=as.factor(c(rep("Yes",length(pred6_yes)),rep("No",length(pred6_no)))))

d7 <- tibble(pred=c(pred7_yes,pred7_no),reinterviewed=as.factor(c(rep("Yes",length(pred7_yes)),rep("No",length(pred7_no)))))

d8 <- tibble(pred=c(pred8_yes,pred8_no),reinterviewed=as.factor(c(rep("Yes",length(pred8_yes)),rep("No",length(pred8_no)))))

a <- ggplot(d1,aes(y=pred,fill=reinterviewed)) + geom_density(na.rm=TRUE,alpha=0.5) +
  coord_flip() + ylab("Density") + xlab("Predicted Outcome") + scale_fill_discrete(name="Reinterviewed") + 
  ggtitle("Learned B>T on Masks") + theme(title=element_text(size=8))
b <- ggplot(d2,aes(y=pred,fill=reinterviewed)) + geom_density(na.rm=TRUE,alpha=0.5) +
  coord_flip() + ylab("Density") + xlab("") + scale_fill_discrete(name="Reinterviewed") +
  ggtitle("Learned B>T on Businesses") + theme(title=element_text(size=8))
c <- ggplot(d3,aes(y=pred,fill=reinterviewed)) + geom_density(na.rm=TRUE,alpha=0.5) + 
  coord_flip() + ylab("Density") + xlab("Predicted Outcome") + scale_fill_discrete(name="Reinterviewed") +
  ggtitle("Learned B>T on the WHO") + theme(title=element_text(size=8))
d <- ggplot(d4,aes(y=pred,fill=reinterviewed)) + geom_density(na.rm=TRUE,alpha=0.5) + coord_flip() + ylab("Density") + xlab("") + scale_fill_discrete(name="Reinterviewed") + ggtitle("Knew B>T on Masks Wave 2") + theme(title=element_text(size=8))
e <- ggplot(d5,aes(y=pred,fill=reinterviewed)) + geom_density(na.rm=TRUE,alpha=0.5) + coord_flip( )+
  ylab("Density") + xlab("Predicted Outcome") + scale_fill_discrete(name="Reinterviewed") +
  ggtitle("Knew B>T on Businesses Wave 2") + theme(title=element_text(size=8))
f <- ggplot(d6,aes(y=pred,fill=reinterviewed)) + geom_density(na.rm=TRUE,alpha=0.5) + coord_flip() +
  ylab("Density") + xlab("") + scale_fill_discrete(name="Reinterviewed") + 
  ggtitle("Knew B>T on WHO Wave 2") + theme(title=element_text(size=8))
g <- ggplot(d7,aes(y=pred,fill=reinterviewed)) + geom_density(na.rm=TRUE,alpha=0.5) + coord_flip() +
  ylab("Density") + xlab("Predicted Outcome") + scale_fill_discrete(name="Reinterviewed") +
  ggtitle("Shifted Away Using Vote Choice") + theme(title=element_text(size=8))
h <- ggplot(d8,aes(y=pred,fill=reinterviewed)) + geom_density(na.rm=TRUE,alpha=0.5) + coord_flip( )+
  ylab("Density") + xlab("") + scale_fill_discrete(name="Reinterviewed") +
  ggtitle("Shifted Away Using Ratings") + theme(title=element_text(size=8))
grid.arrange(a,b,c,d,e,f,g,h,ncol=2)
dat <- dat2
```

## Policy Questions {#issue-questions}
```{r issues,cache=TRUE,fig.topcaption=TRUE}
tab <- tribble(~Issue,~Statement,
"Improve Position of Blacks","The government should make every effort to improve the social and economic position of Blacks",
"Gay Marriage Ban", "A constitutional amendment banning same sex marriages",
"Lower Taxes","Lowering federal taxes",
"Abortion","Restrictions on whether a woman can get an abortion",
"Background Checks for Guns","Strengthening background checks to prevent guns from being \n sold to people with criminal records or mental illness",
"CO2",  "Restricting the amount of carbon dioxide (CO2) factories can emit",
"Muslim Ban", "Preventing any Muslim who is not a US citizen from entering the country",
"Repeal ACA", "Repeal the Affordable Care Act (ACA)",
"WHO",  "The United States should be part of the World Health Organization (WHO)",
"Mexico Wall","Building a wall along the Mexican border",
"Masks in Public","Requiring people to wear masks in public to slow the spread of the coronavirus",
"Free Trade", "Increasing free trade with other countries",
"Income Gap", "Reducing the size of the income gap between rich and poor Americans",
"Close Businesses", "Closing non-essential businesses to slow the spread of the coronavirus")

tab %>% kable("latex",caption="Agree/disagree questions. These are the issues for which we have both respondents' own
positions as well as their perceptions of the candidates' positions.
Respondents were asked whether they and the candidates agree, disagree
or neither agree nor disagree with each item.",booktabs=T,escape=F) %>% kable_styling(font_size = 6,latex_options = "HOLD_position")
```

```{r issues-agreement,cache=TRUE}
tab <- tribble(~Issue,~Statement,
"Work Permit","Allowing existing illegal immigrants to obtain a work permit to stay in the US",
"Taxes on High Incomes","Increasing taxes on households with very high incomes",
"No Favors for Blacks", "Blacks should work their way up without any special favors",
"Health Insurance", "Requiring people to have health insurance",
"Late Abortion Restrictions","Restrictions on abortions in the last three months of pregnancy",
"Early Abortion Restrictions",  "Restrictions on abortions in the first three months of pregnancy",
"Deportations","Deporting all people who entered the US illegally back to their country of origin",
"Roe v Wade", "Appointing judges to the Supreme Court who would overturn the Roe v Wade decision that allowed abortion",
"White Advantage", "White people in the US have advantages because of the color of their skin",
"Affirmative Action","Affirmative action to help Blacks"
)
tab %>% kable(caption="Other agree/disagree questions. For these questions, respondents were asked whether they strongly agree, somewhat agree, neither agree nor disagree, somewhat disagree or strongly disagree with each policy statement.",booktabs = T) %>% kable_styling(font_size = 7,latex_options = "HOLD_position") 
```

```{r issues-effort,cache=TRUE}
tab <- tribble(~Issue,~Statement,
"Hiring Illegal Immigrants","Stopping employers from hiring illegal immigrants",
"Coronavirus Testing","Coronavirus Testing",
"Protecting the environment","Protecting the environment",
"Stay at Home","Making sure people with the coronavirus stay at home",
"Protect from Coronavirus","Protecting Americans from the coronavirus",
"Protect Air","Protecting the air we breathe"
)
tab %>% kable(caption="Government effort questions. Note: for these questions, respondents were asked whether the government should put much more effort, somewhat more effort, the same amount of effort, somewhat less effort or much less effort than than now into achieving each policy goal.",booktabs = T) %>% kable_styling(font_size = 7,latex_options = "HOLD_position")
```

```{r issues-spending,cache=TRUE}
tab <- tribble(~Issue,~Statement,
"Alternative Energies","Developing alternative sources of energy that do not depend on oil",
"Health care","Health care",
"Health care Assistance","Health care assistance to people who cannot afford health insurance",
"Assistsance to the Poor","Assistance to poor people",
"Helping Blacks","Helping Black Americans get ahead"
)
tab %>% kable(caption="Government spending questions. For these questions, respondents were asked whether the government should spend much more, somewhat more, the same amount, somewhat less or much less than than now on achieving each policy goal.",booktabs = T) %>% kable_styling(font_size = 7,latex_options = "HOLD_position")

```

## Post-Election Virus Attitudes
```{r, agreepost,message = F, warning = F, include = T, echo=F,cache = T,fig.height=8,fig.width=6.5,fig.cap="Initial Trump voters' views on coronavirus policies in the August 2020 wave of the panel survey. This figure shows that many Trump voters disagreed with Trump on the thrust of government policy.	In the top panels, the symbols indicate as follows: ++ `much more than now,' + `somewhat more than now,' = `the same as now,' - `somewhat less than now,' -- `much less than now.'",echo=FALSE}
#First set of issues
wide_df <- dat %>% dplyr::select(coronavirustesting_post, stayathome_post, protectcoronavirus_post,vote_pre)
long <- as.data.frame(pivot_longer(wide_df, cols = 1:3, names_to = 'youq', values_to = 'you'))

d <- long %>% filter(vote_pre=="Trump"& !is.na(you)) %>% group_by(youq,you) %>% 
  summarise(value=n()) %>%  mutate(percent=100*value/sum(value))%>%ungroup() 
d$youq[d$youq=='coronavirustesting_post']<-'Coronavirus Testing'
d$youq[d$youq=='stayathome_post']<-'Making People Stay at Home'
d$youq[d$youq=='protectcoronavirus_post']<-'Protecting Against Coronavirus'
d$youq <- factor(d$youq)
d$you <- as.factor(d$you)
levels(d$you) <- c("--","-","=","+","++")
d$percent_lab <- str_c(round(d$percent),"%")
d$y <- d$percent+1
a<-ggplot(d,aes(x=you,y=percent,label=percent_lab)) + 
  geom_bar(stat="identity",position="stack") +
  facet_wrap(vars(youq), nrow = 1)+xlab("") + ylab("Percent") +
  theme(text = element_text(size=9.75)) + 
  ggtitle("(a) How much effort do you want from the federal government on ...") + geom_text(mapping=aes(you,y,label=percent_lab),size=3) + theme(plot.title = element_text(size=10))

#Second set
wide_df <- dat %>% dplyr::select(maskspublic_you_post, closebusiness_you_post, who_you_post,vote_pre)
long <- as.data.frame(pivot_longer(wide_df, cols = 1:3, names_to = 'youq', values_to = 'you'))

d <- long %>% filter(vote_pre=="Trump" & !is.na(you)) %>% group_by(youq,you) %>% 
  summarise(value=n()) %>% ungroup()  %>% group_by(youq)  %>%  mutate(percent=100*value/sum(value))

d$youq[d$youq=='maskspublic_you_post']<-'Mandatory Masks in Public'
d$youq[d$youq=='closebusiness_you_post']<-'Closing Non-Essential Businesses'
d$youq[d$youq=='who_you_post']<-'WHO Membership'
d$youq <- factor(d$youq,levels = c('Mandatory Masks in Public','Closing Non-Essential Businesses','WHO Membership'))


d <- d %>% group_by(youq,you) %>% mutate(percent_lab=sum(percent)) %>% mutate(tot=percent_lab,y=percent_lab+2,percent_lab=str_c(round(percent_lab),"%")) 

levels(d$you)[3]<-"Neutral"
d$you <- factor(d$you,levels=c("Disagree","Neutral","Agree"))  
b<-ggplot(d,aes(x=you,y=percent)) + 
  geom_bar(stat="identity",position="stack") +
  facet_wrap(vars(youq), nrow = 1)+xlab("") + ylab("Percent")+ 
  theme(text = element_text(size=9.75),legend.position = "bottom",legend.margin=margin(c(1,1,1,1)))+ 
  ggtitle("(b) Respondent view on ...") + geom_text(mapping=aes(you,y=y,label=percent_lab),size=3) + theme(plot.title = element_text(size=10))
 
grid.arrange(a,b,nrow=2,heights=c(1,1.1))

```

## Descriptive Statistics {#descriptive-stats}

```{r demotab, results = 'asis', cache = T, echo = F, message = F, warning = F, include = T}

# stata code for acs collapse
# use acs_2019_5yr_clean.dta,clear
# tab age,mis
# g age_1824=age >= 18 & age <= 24 if age!=.
# g age_2534=age >= 25 & age <= 34 if age!=.
# g age_3549=age >= 35 & age <= 49 if age!=.
# g age_5064=age >= 50 & age <= 64 if age!=.
# g age_65=age> 64 if age!=.  
# 
# tab race2,mis
# g race_white= race2 == "white" if race2!=""
# g race_black= race2 == "black" if race2!=""
# g race_asianother= race2 == "other" if race2!=""
# g hispanic= race2 == "hispanic" if race2!=""
# 
# tabulate educnew, generate(educnew)
# tabulate inc, generate(inc)
# 
# collapse (mean) sex age_* race_* hispanic educnew* inc* (count) n=sex [perwt],fast
# save acs_2019_5yr_collapse.dta,replace

acs2019 <- read.dta13("Data/Raw/acs_2019_5yr_collapse.dta")
t <- data.frame(matrix(ncol = 3, nrow = 27))
r <- 1; t[r, 1] <- "Sample"; t[r, 2] <- "Lucid"; t[r, 3] <- "ACS 2019";
r <- r+2; t[r, 1] <- "N"; t[r, 2] <- format(nrow(dat),big.mark=","); 
                          t[r, 3] <- format((acs2019$n),big.mark=",");
r <- r+1; t[r, 1] <- "Gender";
r <- r+1; t[r, 1] <- "Female";t[r, 2] <- round(mean(dat$gender_pre=="female")*100,0);  
                              t[r, 3] <- round(acs2019$sex*100, 0);
r <- r+1; t[r, 1] <- "Age";
r <- r+1; t[r, 1] <- "18-24"; t[r, 2] <- round(mean(dat$age_pre >= 18 & dat$age_pre <= 24)*100, 0); 
                              t[r, 3] <- round((acs2019$age_1824)*100, 0);
r <- r+1; t[r, 1] <- "25-34"; t[r, 2] <- round(mean(dat$age_pre >= 25 & dat$age_pre <= 34)*100, 0); 
                              t[r, 3] <- round((acs2019$age_2534)*100, 0);
r <- r+1; t[r, 1] <- "35-49"; t[r, 2] <- round(mean(dat$age_pre >= 35 & dat$age_pre <= 49)*100, 0); 
                              t[r, 3] <- round((acs2019$age_3549)*100, 0);  
r <- r+1; t[r, 1] <- "50-64"; t[r, 2] <- round(mean(dat$age_pre >= 50 & dat$age_pre <= 64)*100, 0); 
                              t[r, 3] <- round((acs2019$age_5064)*100, 0);
r <- r+1; t[r, 1] <- "65+";  t[r, 2] <- round(mean(dat$age_pre >= 65)*100, 0);
                             t[r, 3] <- round((acs2019$age_65)*100, 0);
r <- r+1; t[r, 1] <- "Race";
r <- r+1; t[r, 1] <- "Non-Hispanic White"; 
          t[r, 2] <- round(mean(dat$white_pre == 1)*100, 0); 
          t[r, 3] <- round((acs2019$race_white)*100, 0);
r <- r+1; t[r, 1] <- "Black"; 
         t[r, 2] <- round(mean(dat$black_pre == 1)*100, 0); 
         t[r, 3] <- round((acs2019$race_black)*100, 0);
r <- r+1; t[r, 1] <- "Asian + Other"; 
         t[r, 2] <- round(mean(dat$race_pre == "Other"|dat$race_pre == "Asian")*100, 0); 
         t[r, 3] <- round((acs2019$race_asianother)*100, 0);
r <- r+1; t[r, 1] <- "Hispanic"; 
         t[r, 2] <- round(mean(dat$hispanic_pre == "hispanic")*100, 0); 
         t[r, 3] <- round((acs2019$hispanic)*100, 0);
r <- r+1; t[r, 1] <- "Education";
r <- r+1; t[r, 1] <- "No College"; 
         t[r, 2] <- round(mean(dat$education_pre == "No college")*100, 0); 
         t[r, 3] <- round((acs2019$educnew1+acs2019$educnew2+acs2019$educnew3)*100, 0);
r <- r+1; t[r, 1] <- "Bachelor's Degree"; 
         t[r, 2] <- round(mean(dat$education_pre == "College")*100, 0); 
         t[r, 3] <- round((acs2019$educnew4)*100, 0);
r <- r+1; t[r, 1] <- "Graduate Degree"; 
         t[r, 2] <- round(mean(dat$education_pre == "Graduate")*100, 0);
         t[r, 3] <- round((acs2019$educnew5)*100, 0);
r <- r+1; t[r, 1] <- "Income";
r <- r+1; t[r, 1] <- "<$20k"; 
         t[r, 2] <- round(mean(dat$hhi_pre <= 2)*100, 0); 
         t[r, 3] <- round((acs2019$inc1)*100, 0);
r <- r+1; t[r, 1] <- "$20k-$39k"; 
         t[r, 2] <- round(mean(dat$hhi_pre >= 3 & dat$hhi_pre <= 6)*100, 0); 
         t[r, 3] <- round((acs2019$inc2 )*100, 0);
r <- r+1; t[r, 1] <- "$40k-$59k"; 
         t[r, 2] <- round(mean(dat$hhi_pre >= 7 & dat$hhi_pre <= 10)*100, 0); 
         t[r, 3] <- round((acs2019$inc3)*100, 0);
r <- r+1; t[r, 1] <- "$60k-$79k"; 
         t[r, 2] <- round(mean(dat$hhi_pre >= 11 & dat$hhi_pre <= 14)*100, 0); 
         t[r, 3] <- round((acs2019$inc4)*100, 0);
r <- r+1; t[r, 1] <- "$80k+"; 
         t[r, 2] <- round(mean(dat$hhi_pre >= 15)*100, 0); 
         t[r, 3] <- round((acs2019$inc5)*100, 0);

options(knitr.kable.NA = '')
kable(t, format = "latex", booktabs = T, format.args = list(big.mark = ",", scientific = FALSE),
  col.names = c(" ","Panel Study","Benchmark"), caption = "Study Demographic Data Compared to Census", linesep = "") %>%
   row_spec(c(0,1,4,6,12,17,21),bold=TRUE) %>% 
  add_footnote("Note: Except for the N row, cell entries provide the percentage of each sample present in each demographic category. In a few cases age and income categories were inconsistent across surveys and were either combined or averaged across other categories. We excluded respondents from the ACS 2019 under 18. We use the 2019 five-year ACS, rather than the 2020, because of Census warnings about Covid-19 interfering with the 2020 ACS. We weight the ACS sample.", notation = "none") %>% kable_styling(latex_options = "HOLD_position",font_size = 7)

```

```{r descTrumpVotePre, include =T,results='asis', cache=T, echo=F, message=F, warning=F}
dat$vote_trump_post<-ifelse(dat$vote_post=="Trump",1,0)
dat$vote_trump_post[is.na(dat$vote_post)] <- 0

desd <- dat %>% filter(vote_pre=="Trump") %>% 
  dplyr::select(vote_trump_post,trumpbiden_pre,trumpbiden_post,coronavirus_pre,coronavirus_post,pidscale_pre,blacks_pre,immigration_pre,redistribution_pre,healthcare_pre,environment_pre,abortion_pre,attention1_post,attention2_post,attention3_post,learneddum_masks,learneddum_closebusiness,learneddum_who,learned_index,coronavirus_test_post)

stargazer(as.data.frame(desd),header=FALSE, 
          title="Descriptive statistics for initial Trump voters",font.size="footnotesize",column.sep.width = "-5pt",label="tab:descTrumpVotePre", 
          covariate.labels=c("Trump vote post","Trump vs Biden ratings pre","Trump vs Biden ratings post","Coronavirus scale pre","Coronavirus scale post","Party identification scale","Aid to blacks scale","Immigration scale","Redistribution scale","Healthcare scale","Environmental scale","Abortion scale","Additional attention check 1","Additional attention check 2", "Additional attention check 3","Learned Trump and Biden masks positions","Learned Trump and Biden close businesses positions","Learned Trump and Biden WHO positions","Learned Trump and Biden Covid positions index","Positive coronavirus test"),table.placement="H")

```

```{r descAll,cache=T, include =T,results='asis', cache=T, echo=F, message=F, warning=F}
dat$vote_trump_post<-ifelse(dat$vote_post=="Trump",1,0)
dat$vote_trump_post[is.na(dat$vote_post)] <- 0

desd <- dat %>% 
  dplyr::select(vote_trump_pre,vote_trump_post,trumpbiden_pre,trumpbiden_post,coronavirus_pre,coronavirus_post,pidscale_pre,blacks_pre,immigration_pre,redistribution_pre,healthcare_pre,environment_pre,abortion_pre,attention1_post,attention2_post,attention3_post,learneddum_masks,learneddum_closebusiness,learneddum_who,learned_index,coronavirus_test_post)

stargazer(as.data.frame(desd),header=FALSE, 
          title="Descriptive statistics for all respondents",font.size="footnotesize",column.sep.width = "-5pt",label="tab:descAll", 
          covariate.labels=c("Trump vote pre","Trump vote post","Trump vs Biden ratings pre","Trump vs Biden ratings post","Coronavirus scale pre","Coronavirus scale post","Party identification scale","Aid to blacks scale","Immigration scale","Redistribution scale","Healthcare scale","Environmental scale","Abortion scale","Additional attention check 1","Additional attention check 2", "Additional attention check 3","Learned Trump and Biden masks positions","Learned Trump and Biden close businesses positions","Learned Trump and Biden WHO positions","Learned Trump and Biden Covid positions index","Positive coronavirus test"),table.placement="H")

```


## Attention and Knowledge of Stances {#attention}

It's possible that respondents aren't reporting that Biden supported more aggressive policies on Covid than Trump because of low attention to the survey, a chronic problem on online surveys. Respondents may have known Biden's and Trump's stances, but not reported them accurately because they weren't paying attention to the survey. We took steps to address this in our first wave by only interviewing respondents who passed an attention screen. But attention remains a concern, since it would lower rates of apparent knowledge. In this section, we report on additional robustness checks to attention. We asked three attention check questions in the second wave survey. Two relatively easy ones and one very hard one. Regardless of how we cut the data, however, we don't find much higher knowledge of Biden's and Trump's stances among respondents who pass these attention checks. 

Before we show these checks, we remind the reader that Figure \@ref(fig:supplearn)(b) showed the percent of initial Trump voters who disagreed with him and who placed Biden as pursuing a more aggressive Covid-19 policy than Trump in August and November. To summarize these again:

- On mandatory masks, `r round(mean(dat$maskspublic_cand_pre[dat$vote_pre=="Trump"& dat$maskspublic_you_pre=="Agree"],na.rm = T),2)*100`% of initial Trump voters who disagreed with him placed Biden as more supportive of masks in August and `r round(mean(dat$maskspublic_cand_post[dat$vote_pre=="Trump"&dat$maskspublic_you_pre=="Agree"],na.rm = T),2)*100`% did so after the election. On closing non-essential businesses, these percentages are `r round(mean(dat$closebusiness_cand_pre[dat$vote_pre=="Trump" &dat$closebusiness_you_pre=="Agree"],na.rm = T),2)*100`% and `r round(mean(dat$closebusiness_cand_post[dat$vote_pre=="Trump"&dat$closebusiness_you_pre=="Agree"],na.rm = T),2)*100`%. On the WHO, these are `r round(mean(dat$who_cand_pre[dat$vote_pre=="Trump"&dat$who_you_pre=="Agree"],na.rm = T),2)*100`% and `r round(mean(dat$who_cand_post[dat$vote_pre=="Trump" &dat$who_you_pre=="Agree"],na.rm = T),2)*100`%. 
- Among all initial Trump voters, these are `r round(mean(dat$maskspublic_cand_pre[dat$vote_pre=="Trump"],na.rm = T),2)*100`% vs. `r round(mean(dat$maskspublic_cand_post[dat$vote_pre=="Trump"],na.rm = T),2)*100`%, `r round(mean(dat$closebusiness_cand_pre[dat$vote_pre=="Trump"],na.rm = T),2)*100`% vs. `r round(mean(dat$closebusiness_cand_post[dat$vote_pre=="Trump"],na.rm = T),2)*100`%, and `r round(mean(dat$who_cand_pre[dat$vote_pre=="Trump"],na.rm = T),2)*100`% vs. `r round(mean(dat$who_cand_post[dat$vote_pre=="Trump"],na.rm = T),2)*100`%. 
- Among all respondents, these are `r round(mean(dat$maskspublic_cand_pre,na.rm = T),2)*100`% vs. `r round(mean(dat$maskspublic_cand_post,na.rm = T),2)*100`%, `r round(mean(dat$closebusiness_cand_pre,na.rm = T),2)*100`% vs. `r round(mean(dat$closebusiness_cand_post,na.rm = T),2)*100`%, and `r round(mean(dat$who_cand_pre,na.rm = T),2)*100`% vs. `r round(mean(dat$who_cand_post,na.rm = T),2)*100`%. 

To check whether these increase with apparent attention, we first use two additional attention check questions in the second wave survey, which were relatively easy.  `r round(mean( dat$attention2_post==1,na.rm = T),2)*100`% and `r round(mean( dat$attention3_post==1,na.rm = T),2)*100`%  passed these:

- Among all initial Trump voters who initially disagreed with him, these percentages placing Biden to the left of Trump on masks closing nonessential businesses, and the WHO are `r round(mean(dat$maskspublic_cand_pre[dat$vote_pre=="Trump"& dat$maskspublic_you_pre=="Agree" & dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`% vs. `r round(mean(dat$maskspublic_cand_post[dat$vote_pre=="Trump" & dat$maskspublic_you_pre=="Agree"& dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`%, `r round(mean(dat$closebusiness_cand_pre[dat$vote_pre=="Trump" &dat$closebusiness_you_pre=="Agree"& dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`% vs. `r round(mean(dat$closebusiness_cand_post[dat$vote_pre=="Trump" &dat$closebusiness_you_pre=="Agree"& dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`%, and `r round(mean(dat$who_cand_pre[dat$vote_pre=="Trump"&dat$who_you_pre=="Agree" & dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`% vs. `r round(mean(dat$who_cand_post[dat$vote_pre=="Trump"&dat$who_you_pre=="Agree" & dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`%. 
- Among all initial Trump voters, these percentages are `r round(mean(dat$maskspublic_cand_pre[dat$vote_pre=="Trump" & dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`% vs. `r round(mean(dat$maskspublic_cand_post[dat$vote_pre=="Trump" & dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`%, `r round(mean(dat$closebusiness_cand_pre[dat$vote_pre=="Trump" & dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`% vs. `r round(mean(dat$closebusiness_cand_post[dat$vote_pre=="Trump" & dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`%, and `r round(mean(dat$who_cand_pre[dat$vote_pre=="Trump" & dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`% vs. `r round(mean(dat$who_cand_post[dat$vote_pre=="Trump" & dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`%. 
- Among all respondents, these are `r round(mean(dat$maskspublic_cand_pre[dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`% vs. `r round(mean(dat$maskspublic_cand_post[dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`%, `r round(mean(dat$closebusiness_cand_pre[dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`% vs. `r round(mean(dat$closebusiness_cand_post[dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`%, and `r round(mean(dat$who_cand_pre[dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`% vs. `r round(mean(dat$who_cand_post[dat$attention2_post==1 & dat$attention3_post==1],na.rm = T),2)*100`%. 

We also asked a hard attention check that only `r round(mean(dat$attention1_post==1,na.rm = T),2)*100`%  passed. Here we do find somewhat higher levels of knowledge, but still low given the magnitude of the crisis---not much above chance for initial Trump voters who initially disagreed with him:

- Among all initial Trump voters who initially disagreed with him, the percentages placing Biden to the left of Trump on masks, closing nonessential businesses, and the WHO are `r round(mean(dat$maskspublic_cand_pre[dat$vote_pre=="Trump"& dat$maskspublic_you_pre=="Agree" & dat$attention1_post==1],na.rm = T),2)*100`% vs. `r round(mean(dat$maskspublic_cand_post[dat$vote_pre=="Trump" & dat$maskspublic_you_pre=="Agree"& dat$attention1_post==1],na.rm = T),2)*100`%, `r round(mean(dat$closebusiness_cand_pre[dat$vote_pre=="Trump" &dat$closebusiness_you_pre=="Agree"& dat$attention1_post==1],na.rm = T),2)*100`% vs. `r round(mean(dat$closebusiness_cand_post[dat$vote_pre=="Trump" &dat$closebusiness_you_pre=="Agree"& dat$attention1_post==1],na.rm = T),2)*100`%, and `r round(mean(dat$who_cand_pre[dat$vote_pre=="Trump"&dat$who_you_pre=="Agree" & dat$attention1_post==1],na.rm = T),2)*100`% vs. `r round(mean(dat$who_cand_post[dat$vote_pre=="Trump"&dat$who_you_pre=="Agree" & dat$attention1_post==1],na.rm = T),2)*100`%. 
- Among all initial Trump voters, these percentages are `r round(mean(dat$maskspublic_cand_pre[dat$vote_pre=="Trump" & dat$attention1_post==1],na.rm = T),2)*100`% vs. `r round(mean(dat$maskspublic_cand_post[dat$vote_pre=="Trump" & dat$attention1_post==1],na.rm = T),2)*100`%, `r round(mean(dat$closebusiness_cand_pre[dat$vote_pre=="Trump" & dat$attention1_post==1],na.rm = T),2)*100`% vs. `r round(mean(dat$closebusiness_cand_post[dat$vote_pre=="Trump" & dat$attention1_post==1 ],na.rm = T),2)*100`%, and `r round(mean(dat$who_cand_pre[dat$vote_pre=="Trump" & dat$attention1_post==1 ],na.rm = T),2)*100`% vs. `r round(mean(dat$who_cand_post[dat$vote_pre=="Trump" & dat$attention1_post==1 ],na.rm = T),2)*100`%. 
- Among all respondents, these are `r round(mean(dat$maskspublic_cand_pre[dat$attention1_post==1 ],na.rm = T),2)*100`% vs. `r round(mean(dat$maskspublic_cand_post[dat$attention1_post==1 ],na.rm = T),2)*100`%, `r round(mean(dat$closebusiness_cand_pre[dat$attention1_post==1 ],na.rm = T),2)*100`% vs. `r round(mean(dat$closebusiness_cand_post[dat$attention1_post==1 ],na.rm = T),2)*100`%, and `r round(mean(dat$who_cand_pre[dat$attention1_post==1 ],na.rm = T),2)*100`% vs. `r round(mean(dat$who_cand_post[dat$attention1_post==1 ],na.rm = T),2)*100`%. 

## Guess Correction  {#guesscorrection}

We briefly reference guess correction on whether people place Biden to the left of Trump on each of our three Covid policy issues. The guess correction equation applied is Percent Correct - Percent Incorrect * (Number Correct Response Options/Number Incorrect Response Options). It assumes that (a) all wrong answers are guesses and that (b) guessers distribute their guesses uniformly over response options. In this case, wrong answers are sometimes projection, especially on masks, for initial Trump voters. If we ignore skipping, there are three correct response options out of nine possible responses. If we incorporate skipping, it's 3/12. Among all respondents, these calculations suggest around 55%-60% had a sense for the candidate stances across the three issues, fairly typical of candidate stances more generally.

## Analyses Using Weights {#analyses-weights}

In this section, we repeat figures from the main text, except analyses are weighted. We create weights by raking on the margins of age, gender, education, race, and Hispanic ethnicity using the American Community Survey. We first create weights for the first wave, then create weights for the second wave after applying first-wave weights.


```{r agree-weighted,message = F, warning = F, include = T, echo=F,cache = T,fig.cap="Weighted Trump voters' views on coronavirus policies (weighted)"}
#First set of issues
wide_df <- dat %>% dplyr::select(coronavirustesting_pre, stayathome_pre, protectcoronavirus_pre,vote_pre,weights_post)
long <- as.data.frame(pivot_longer(wide_df, cols = 1:3, names_to = 'youq', values_to = 'you'))

d <- long %>% filter(vote_pre=="Trump" & !is.na(you)) %>% count(youq,you,wt=weights_post*nrow(dat)) %>%  group_by(youq) %>% summarise(percent=100*n/sum(n),you)

d$youq[d$youq=='coronavirustesting_pre']<-'Coronavirus Testing'
d$youq[d$youq=='stayathome_pre']<-'Making People Stay at Home'
d$youq[d$youq=='protectcoronavirus_pre']<-'Protecting Against Coronavirus'
d$youq <- factor(d$youq)
d$you <- as.factor(d$you)
levels(d$you) <- c("--","-","=","+","++")
d$percent_lab <- str_c(round(d$percent),"%")
d$y <- d$percent+3
a<-ggplot(d,aes(x=you,y=percent,label=percent_lab)) + 
  geom_bar(stat="identity",position="stack") +
  facet_wrap(vars(youq), nrow = 1)+xlab("") + ylab("Percent") +
  theme(text = element_text(size=9.75)) + 
  ggtitle("(a) How much effort do you want from the federal government on ...") + geom_text(mapping=aes(you,y,label=percent_lab),size=3)


#Second set
wide_df <- dat %>% dplyr::select(maskspublic_you_pre, closebusiness_you_pre, who_you_pre,vote_pre,weights_post)
long <- as.data.frame(pivot_longer(wide_df, cols = 1:3, names_to = 'youq', values_to = 'you'))

d <- long %>%   filter(vote_pre=="Trump"& !is.na(you)) %>% count(youq,you,wt=weights_post*nrow(dat)) %>%  group_by(youq) %>% summarise(percent=100*n/sum(n),you)


d$youq[d$youq=='maskspublic_you_pre']<-'Mandatory Masks in Public'
d$youq[d$youq=='closebusiness_you_pre']<-'Closing Non-Essential Businesses'
d$youq[d$youq=='who_you_pre']<-'WHO Membership'
d$youq <- factor(d$youq,levels = c('Mandatory Masks in Public','Closing Non-Essential Businesses','WHO Membership'))


d <- d %>% group_by(youq,you) %>% mutate(percent_lab=sum(percent)) %>% mutate(tot=percent_lab,y=percent_lab+3,percent_lab=str_c(round(percent_lab),"%")) %>% group_by(youq,you) 

levels(d$you)[3]<-"Neutral"
  
b<-ggplot(d,aes(x=you,y=percent)) + 
  geom_bar(stat="identity",position="stack") +
  facet_wrap(vars(youq), nrow = 1)+xlab("") + ylab("Percent")+ 
  theme(text = element_text(size=9.75),legend.position = "bottom",legend.margin=margin(c(1,1,1,1)))+ 
  ggtitle("(b) Respondent view on ...") + geom_text(mapping=aes(you,y=y,label=percent_lab),size=3)
 
grid.arrange(a,b,nrow=2,heights=c(1,1.1))

```

```{r knowledge-weighted,cache=T,fig.height=2,fig.width=6.5,fig.cap="Weighted knowledge of the candidates’ positions on Covid issues among Trump supporters who disagreed with him on each issue (weighted)"}
wide_df <- dat %>% dplyr::select(kn_masks, kn_business, kn_who,vote_pre,maskspublic_you_pre,closebusiness_you_pre,who_you_pre,weights_post)
long <- as.data.frame(pivot_longer(wide_df, cols = 1:3, names_to = 'knowq', values_to = 'know'))

# Only include those who disagred with Trump (i.e. agreed with policies)
long <- long %>% filter((knowq=="kn_masks" & maskspublic_you_pre=="Agree") | (knowq=="kn_business" & closebusiness_you_pre=="Agree") | (knowq=="kn_who" & who_you_pre=="Agree"))
d <- long %>%   filter(vote_pre=="Trump") %>% group_by(knowq,know) %>% 
  summarise(value=sum(weights_post)) %>% ungroup()  %>% group_by(knowq)  %>%  mutate(percent=100*value/sum(value))

d$knowq[d$knowq=='kn_masks']<-'Mandatory Masks in Public'
d$knowq[d$knowq=='kn_business']<-'Close Non-Essential Businesses'
d$knowq[d$knowq=='kn_who']<-'WHO Membership'
d$knowq <- factor(d$knowq,levels = c('Mandatory Masks in Public',
                                   'Close Non-Essential Businesses','WHO Membership'))

d <- d %>% mutate(y=percent+3.25,percent_lab=str_c(round(percent),"%")) 
d$know <- factor(d$know,levels=c("B>T","B=T","T>B"))
ggplot(d,aes(x=know,y=percent)) + 
  geom_bar(stat="identity",position="stack") +
  facet_wrap(vars(knowq), nrow = 1)+xlab("") + 
  ylab("")+ 
  theme(text = element_text(size=9.75),legend.position = "bottom",legend.margin=margin(c(1,1,1,1)))+
  geom_text(mapping=aes(know,y=y,label=percent_lab),size=3)

```

```{r supplearn-weighted, echo=FALSE, message = F, warning = F, include = T, cache = T,fig.height=2,fig.width=6.5,fig.cap="Weighted learning category among initial Trump supporters who disagreed with Trump on each issue (weighted)"}
#mandatory masks in public
d1 <- dat %>% filter(vote_pre=="Trump" & !is.na(punished) & maskspublic_you_pre=="Agree") %>% # excludes all but people who disagree with trump
 count(learned_masks) %>% ungroup() %>% mutate(percent=100*n/sum(n))
d1$q <- "Mandatory Masks in Public"

#close nonessential businesses
d2 <- dat %>% filter(vote_pre=="Trump" & !is.na(punished) & closebusiness_you_pre=="Agree") %>% count(learned_closebusiness) %>% ungroup() %>% mutate(percent=100*n/sum(n))
d2$q <- "Close Non-Essential Businesses"

#WHO membership
d3 <- dat %>% filter(vote_pre=="Trump" & !is.na(punished) & who_you_pre=="Agree") %>% count(learned_who) %>% ungroup() %>% mutate(percent=100*n/sum(n))
d3$q <- "WHO Membership"

d1<-rename(d1,learned=learned_masks);d2<-rename(d2,learned=learned_closebusiness);d3<-rename(d3,learned=learned_who)
d<-bind_rows(d1,d2,d3)

d <- d %>% group_by(learned,q) %>% mutate(z=percent+3.25)
d$percent_label <- as.character(round(d$percent))
d$percent_label <- str_c(d$percent_label,"%",sep=" ")

d$q <- factor(d$q,levels=c("Mandatory Masks in Public", "Close Non-Essential Businesses", 
"WHO Membership"))
ggplot(d,aes(x=learned,y=percent)) + 
 geom_bar(stat="identity",position="stack") + scale_fill_grey(name="Punished") +
 facet_wrap(vars(q), nrow = 1)+xlab("") + ylab("Percent") + 
 theme(legend.position = "bottom",legend.margin=margin(c(1,1,1,1))) + geom_text(mapping=aes(learned,z,label=percent_label),colour="black",size=3)

```

```{r punished-weighted,cache=T,fig.height=2,fig.width=8,fig.cap="Weighted shifting away from Trump vote among initial Trump voters who disagreed with him on Covid policies by whether they learned they disagree with him"}
# Masks in public
d1 <- dat %>% filter(vote_pre=="Trump" & !is.na(punished) & maskspublic_you_pre=="Agree") %>% # excludes all but people who disagree with trump
 count(punished,learned_masks,wt=weights_post*nrow(dat)) %>% group_by(learned_masks) %>% mutate(percent=100*n/sum(n))
d1$q <- "Mandatory Masks in Public"

#close nonessential businesses
d2 <- dat %>% filter(vote_pre=="Trump" & !is.na(punished) & closebusiness_you_pre=="Agree") %>% count(punished,learned_closebusiness,wt=weights_post*nrow(dat)) %>% group_by(learned_closebusiness) %>% mutate(percent=100*n/sum(n))
d2$q <- "Close Non-Essential Businesses"

#WHO membership
d3 <- dat %>% filter(vote_pre=="Trump" & !is.na(punished) & who_you_pre=="Agree") %>% count(punished,learned_who,wt=weights_post*nrow(dat)) %>% group_by(learned_who) %>% mutate(percent=100*n/sum(n))
d3$q <- "WHO Membership"

d1<-rename(d1,learned=learned_masks);d2<-rename(d2,learned=learned_closebusiness);d3<-rename(d3,learned=learned_who)
d<-bind_rows(d1,d2,d3)

d$punished <- factor(d$punished,levels=c('Punished','Did not punish','Missing Candidate Ratings'))
d <- d %>% group_by(learned,q) %>% mutate(y=percent+3.25) 
d$percent_label <- str_c(round(d$percent),"%")
d <- d %>% filter(punished=="Punished")
d$q <- factor(d$q,levels=c("Mandatory Masks in Public", "Close Non-Essential Businesses", 
"WHO Membership"))
ggplot(d,aes(x=learned,y=percent)) + 
 geom_bar(stat="identity") +
 facet_wrap(vars(q), nrow = 1)+xlab("") + ylab("Percent") + 
 theme(legend.position = "bottom",legend.margin=margin(c(1,1,1,1))) + geom_text(mapping=aes(learned,y,label=percent_label),colour="black",size=4) 

```

```{r, reactions-weighted-vote,cache=T,echo=FALSE,fig.cap="Reactions to Trump's positions on each issue among Trump voters who disagreed with him. This figure considers whether Trump voters decided to vote against him. It shows that learning and abandoning Trump was one of the least common reactions on each issue.",fig.height=8,fig.width=6.5}
d <- dat %>% 
  filter(vote_pre=="Trump" & maskspublic_you_pre=="Agree") %>% 
  summarise(neverlearned=weighted.mean(learned_masks=="Neither",weights_post,na.rm=T),projectedpunished=weighted.mean(learned_masks=="Projected" & punished_vote==1,weights_post,na.rm=T),projectednopunish=weighted.mean(learned_masks=="Projected" & punished_vote==0,weights_post,na.rm=T),learnedpunished=weighted.mean(learned_masks=="Learned" & punished_vote==1,weights_post,na.rm=T),learnednopunish=weighted.mean(learned_masks=="Learned" & punished_vote==0,weights_post,na.rm=T)) %>% pivot_longer(neverlearned:learnednopunish,names_to="reaction",values_to="percent") %>% mutate(percent=100*percent,percent_lab=str_c(round(percent),"%"),y=percent+3)
d$reaction <- factor(d$reaction)
levels(d$reaction) <- c("Learned\n but did not abandon","Learned\n and abandoned","Knowledge unchanged","Projected\n and did not abandon","Projected\n and abandoned")

a <- d %>% ggplot(aes(x=fct_reorder(reaction,percent,.desc=T),y=percent)) + geom_col() + xlab("") + ylab("Percent") + geom_text(mapping=aes(reaction,y,label=percent_lab),size=3) + ggtitle("Masks in Public") + theme(plot.title = element_text(hjust = 0.5))

d <- dat %>% filter(vote_pre=="Trump" & closebusiness_you_pre=="Agree") %>% summarise(neverlearned=weighted.mean(learned_closebusiness=="Neither",weights_post,na.rm=T),projectedpunished=weighted.mean(learned_masks=="Projected" & punished_vote==1,weights_post,na.rm=T),projectednopunish=weighted.mean(learned_masks=="Projected" & punished_vote==0,weights_post,na.rm=T),learnedpunished=weighted.mean(learned_closebusiness=="Learned" & punished_vote==1,na.rm=T),learnednopunish=weighted.mean(learned_closebusiness=="Learned" & punished_vote==0,weights_post,na.rm=T)) %>% pivot_longer(neverlearned:learnednopunish,names_to="reaction",values_to="percent") %>% mutate(percent=100*percent,percent_lab=str_c(round(percent),"%"),y=percent+3)
d$reaction <- factor(d$reaction)
levels(d$reaction) <- c("Learned\n but did not abandon","Learned\n and abandoned","Knowledge unchanged","Projected\n and did not abandon","Projected\n and abandoned")

b <- d %>% ggplot(aes(x=fct_reorder(reaction,percent,.desc=T),y=percent)) + geom_col() + xlab("") + ylab("Percent") + geom_text(mapping=aes(reaction,y,label=percent_lab),size=3) + ggtitle("Close Businesses") + theme(plot.title = element_text(hjust = 0.5))

# WHO
d <- dat %>% filter(vote_pre=="Trump" & who_you_pre=="Agree") %>% summarise(neverlearned=weighted.mean(learned_who=="Neither",weights_post,na.rm=T),projectedpunished=mean(learned_masks=="Projected" & punished=="Punished",na.rm=T),projectednopunish=weighted.mean(learned_masks=="Projected" & punished!="Punished",weights_post,na.rm=T),learnedpunished=weighted.mean(learned_who=="Learned" & punished=="Punished",weights_post,na.rm=T),learnednopunish=weighted.mean(learned_who=="Learned" & punished!="Punished",weights_post,na.rm=T)) %>% pivot_longer(neverlearned:learnednopunish,names_to="reaction",values_to="percent") %>% mutate(percent=100*percent,percent_lab=str_c(round(percent),"%"),y=percent+3.25)
d$reaction <- factor(d$reaction)
levels(d$reaction) <- c("Learned\n but did not abandon","Learned\n and abandoned","Knowledge unchanged","Projected\n and did not abandon","Projected\n and abandoned")

c <- d %>% ggplot(aes(x=fct_reorder(reaction,percent,.desc=T),y=percent)) + geom_col() + xlab("") + ylab("Percent") + geom_text(mapping=aes(reaction,y,label=percent_lab),size=3) + ggtitle("WHO") + theme(plot.title = element_text(hjust = 0.5))

m <- marrangeGrob(list(a,b,c),ncol=1,nrow=3,top="",bottom="")
m
```

```{r, reactions-weighted-ratings,cache=T,echo=FALSE,fig.cap="Weighted reactions to Trump's positions on each issue among Trump voters who disagreed with him. Shifting away from Trump is assessed using relative candidate ratings. This figure shows that learning and shifting away from Trump was one of the least common reactions on each issue.",fig.height=8,fig.width=6.5}
d <- dat %>% 
  filter(vote_pre=="Trump" & maskspublic_you_pre=="Agree") %>% 
  summarise(neverlearned=weighted.mean(learned_masks=="Neither",weights_post,na.rm=T),projectedpunished=weighted.mean(learned_masks=="Projected" & punished=="Punished",weights_post,na.rm=T),projectednopunish=weighted.mean(learned_masks=="Projected" & punished!="Punished",weights_post,na.rm=T),learnedpunished=weighted.mean(learned_masks=="Learned" & punished=="Punished",weights_post,na.rm=T),learnednopunish=weighted.mean(learned_masks=="Learned" & punished!="Punished",weights_post,na.rm=T)) %>% pivot_longer(neverlearned:learnednopunish,names_to="reaction",values_to="percent") %>% mutate(percent=100*percent,percent_lab=str_c(round(percent),"%"),y=percent+3)
d$reaction <- factor(d$reaction)
levels(d$reaction) <- c("Learned\n but did not shift\n away","Learned\n and shifted away","Knowledge unchanged","Projected\n and did not shift away","Projected\n and shifted away")

a <- d %>% ggplot(aes(x=fct_reorder(reaction,percent,.desc=T),y=percent)) + geom_col() + xlab("") + ylab("Percent") + geom_text(mapping=aes(reaction,y,label=percent_lab)) + ggtitle("Masks in Public") + theme(plot.title = element_text(hjust = 0.5))

d <- dat %>% filter(vote_pre=="Trump" & closebusiness_you_pre=="Agree") %>% summarise(neverlearned=weighted.mean(learned_closebusiness=="Neither",weights_post,na.rm=T),projectedpunished=weighted.mean(learned_masks=="Projected" & punished=="Punished",weights_post,na.rm=T),projectednopunish=weighted.mean(learned_masks=="Projected" & punished!="Punished",weights_post,na.rm=T),learnedpunished=weighted.mean(learned_closebusiness=="Learned" & punished=="Punished",na.rm=T),learnednopunish=weighted.mean(learned_closebusiness=="Learned" & punished!="Punished",weights_post,na.rm=T)) %>% pivot_longer(neverlearned:learnednopunish,names_to="reaction",values_to="percent") %>% mutate(percent=100*percent,percent_lab=str_c(round(percent),"%"),y=percent+3)
d$reaction <- factor(d$reaction)
levels(d$reaction) <- c("Learned\n but did not shift away","Learned\n and shifted away","Knowledge unchanged","Projected\n and did not shift away","Projected\n and shifted away")

b <- d %>% ggplot(aes(x=fct_reorder(reaction,percent,.desc=T),y=percent)) + geom_col() + xlab("") + ylab("Percent") + geom_text(mapping=aes(reaction,y,label=percent_lab)) + ggtitle("Close Businesses") + theme(plot.title = element_text(hjust = 0.5))

# WHO
d <- dat %>% filter(vote_pre=="Trump" & who_you_pre=="Agree") %>% summarise(neverlearned=weighted.mean(learned_who=="Neither",weights_post,na.rm=T),projectedpunished=mean(learned_masks=="Projected" & punished=="Punished",na.rm=T),projectednopunish=weighted.mean(learned_masks=="Projected" & punished!="Punished",weights_post,na.rm=T),learnedpunished=weighted.mean(learned_who=="Learned" & punished=="Punished",weights_post,na.rm=T),learnednopunish=weighted.mean(learned_who=="Learned" & punished!="Punished",weights_post,na.rm=T)) %>% pivot_longer(neverlearned:learnednopunish,names_to="reaction",values_to="percent") %>% mutate(percent=100*percent,percent_lab=str_c(round(percent),"%"),y=percent+3)
d$reaction <- factor(d$reaction)
levels(d$reaction) <- c("Learned\n but did not shift\n away","Learned\n and shifted\n away","Knowledge unchanged","Projected\n and did not shift away","Projected\n and shifted away")

c <- d %>% ggplot(aes(x=fct_reorder(reaction,percent,.desc=T),y=percent)) + geom_col() + xlab("") + ylab("Percent") + geom_text(mapping=aes(reaction,y,label=percent_lab)) + ggtitle("WHO") + theme(plot.title = element_text(hjust = 0.5))

m <- marrangeGrob(list(a,b,c),ncol=1,nrow=3,top="",bottom="")
m
```


##  Additional Regression Estimates

This section presents regression tables that offer robustness checks on the main regressions in the paper.

```{r leadbyissuereglearningTrumpcontrols,echo=FALSE,cache=F,results='asis',message=FALSE,warning=FALSE,include=T}

dat$learneddum2_masks <- ifelse(dat$maskspublic_cand_pre==0& 
                                     dat$maskspublic_cand_post==1,1,0) 
dat$learneddum2_closebusiness<-ifelse(dat$closebusiness_cand_pre==0&
                                        dat$closebusiness_cand_post==1,1,0) 
dat$learneddum2_who <- ifelse(dat$who_cand_pre==0&dat$who_cand_post==1,1,0) 

#Data for regressions
dreg <- dat  %>%   filter(vote_pre=="Trump") %>%  
  dplyr::select(vote_trump_postp5,vote_trump_prep5,maskspublic_cand_pre,maskspublic_cand_post,
                closebusiness_cand_pre,closebusiness_cand_post,
                who_cand_pre,who_cand_post,
                learneddum2_masks,learneddum2_closebusiness,learneddum2_who,
                maskspublic_you2_post,closebusiness_you2_post,who_you2_post,
                maskspublic_you2_pre,closebusiness_you2_pre,who_you2_pre,pidscale_pre,blacks_pre,
                  immigration_pre,redistribution_pre,healthcare_pre,environment_pre,abortion_pre)

models <- list(
  "Mandatory Masks"     
  = lm(vote_trump_postp5~learneddum2_masks*maskspublic_you2_pre+learneddum2_masks*vote_trump_prep5+
         pidscale_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,
               data = subset(dreg,maskspublic_cand_pre==0&maskspublic_cand_post==1|
                  maskspublic_cand_pre==0&maskspublic_cand_post==0) ),
  "Close Businesses"     
  = lm(vote_trump_postp5~learneddum2_closebusiness*closebusiness_you2_pre+learneddum2_closebusiness*vote_trump_prep5+
         pidscale_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,
               data = subset(dreg,closebusiness_cand_pre==0&closebusiness_cand_post==1|
                  closebusiness_cand_pre==0&closebusiness_cand_post==0)),
  "WHO Membership"     
  = lm(vote_trump_postp5~learneddum2_who*who_you2_pre+learneddum2_who*vote_trump_prep5+pidscale_pre+blacks_pre+
         immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,
               data = subset(dreg,who_cand_pre==0&who_cand_post==1|
                  who_cand_pre==0&who_cand_post==0))
)
cap = "Does Learning Lead to Voting on Three Coronavirus Policy Issues---Comparison to Those Who Never Learn. Each column shows a separate least-squares regression with standard errors in parentheses." 
modelsummary(models,gof_omit="BIC|AIC|F|Log.Lik.|RMSE|R2 Adj.|Std.Errors",output = 'kableExtra',stars = F, statistic = 'conf.int',title = cap, vcov = "HC3",coef_rename = c("learneddum2_masks" = "Learned Stance on the Policy", 
                      "learneddum2_closebusiness" = "Learned Stance on the Policy",
                      "learneddum2_who" = "Learned Stance on the Policy",
                             "maskspublic_you2_pre" = "Support for Covid Policy Pre",
                             "closebusiness_you2_pre" = "Support for Covid Policy Pre",
                             "who_you2_pre" = "Support for Covid Policy Pre",
                       "vote_trump_prep5" = "Lagged DV", 
           "learneddum2_masks:maskspublic_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_closebusiness:closebusiness_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_who:who_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_masks:vote_trump_prep5"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_closebusiness:vote_trump_prep5"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_who:vote_trump_prep5"="Learned Stance on the Policy X Lagged DV",
                              "pidscale_pre" = "Partisanship Scale",
        "blacks_pre" = "Attitudes about Aiding Blacks",
        "immigration_pre" = "Attitudes about Immigration",
        "redistribution_pre" = "Attitudes about Redistribution",
        "healthcare_pre" = "Attitudes about Healthcare",
        "environment_pre" = "Attitudes about Environment",
        "abortion_pre" = "Attitudes about Abortion") )  %>%
  
  footnote("This table shows the results of separately regressing November vote (the lagged dependent variable) on an indicator for whether they learned the candidate stances on each of these issues (0/1, relative measure), their attitude on  each respective issue in August, and the interaction. Trump vote coded Biden 0, 0.5 Other/No vote, and Trump 1. All variables coded 0-1. The number of observations varies across the regressions because the number of respondents who don't know the stances in August varies.",
    footnote_as_chunk = F ,
    escape = F, threeparttable = TRUE
  )  %>% 
    add_header_above(c(" " = 1, "DV: Vote for Trump"=3)) %>% 
  kable_styling(font_size = 9,latex_options="HOLD_position")
```

```{r leadbyissuereglearningcontrols,echo=FALSE,cache=F,results='asis',message=FALSE,warning=FALSE,include=T}

dat$learneddum2_masks <- ifelse(dat$maskspublic_cand_pre==0& 
                                     dat$maskspublic_cand_post==1,1,0) 
dat$learneddum2_closebusiness<-ifelse(dat$closebusiness_cand_pre==0&
                                        dat$closebusiness_cand_post==1,1,0) 
dat$learneddum2_who <- ifelse(dat$who_cand_pre==0&dat$who_cand_post==1,1,0) 

#Data for regressions
dreg <- dat  %>% 
  dplyr::select(vote_trump_postp5,vote_trump_prep5,maskspublic_cand_pre,maskspublic_cand_post,
                closebusiness_cand_pre,closebusiness_cand_post,
                who_cand_pre,who_cand_post,
                learneddum2_masks,learneddum2_closebusiness,learneddum2_who,
                maskspublic_you2_post,closebusiness_you2_post,who_you2_post,
                maskspublic_you2_pre,closebusiness_you2_pre,who_you2_pre,pidscale_pre,blacks_pre,
                  immigration_pre,redistribution_pre,healthcare_pre,environment_pre,abortion_pre)

models <- list(
  "Mandatory Masks"     
  = lm(vote_trump_postp5~learneddum2_masks*maskspublic_you2_pre+learneddum2_masks*vote_trump_prep5+
         pidscale_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,
               data = subset(dreg,maskspublic_cand_pre==0&maskspublic_cand_post==1|
                  maskspublic_cand_pre==0&maskspublic_cand_post==0) ),
  "Close Businesses"     
  = lm(vote_trump_postp5~learneddum2_closebusiness*closebusiness_you2_pre+learneddum2_closebusiness*vote_trump_prep5+
         pidscale_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,
               data = subset(dreg,closebusiness_cand_pre==0&closebusiness_cand_post==1|
                  closebusiness_cand_pre==0&closebusiness_cand_post==0)),
  "WHO Membership"     
  = lm(vote_trump_postp5~learneddum2_who*who_you2_pre+learneddum2_who*vote_trump_prep5+pidscale_pre+blacks_pre+
         immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,
               data = subset(dreg,who_cand_pre==0&who_cand_post==1|
                  who_cand_pre==0&who_cand_post==0))
)
cap = "Does Learning Lead to Voting on Three Coronavirus Policy Issues---Comparison to Those Who Never Learn. Each column shows a separate least-squares regression." 
modelsummary(models,gof_omit="BIC|AIC|F|Log.Lik.|RMSE|R2 Adj.|Std.Errors",output = 'kableExtra',stars = F,statistic = 'conf.int',title = cap, vcov = "HC3",coef_rename = c("learneddum2_masks" = "Learned Stance on the Policy", 
                      "learneddum2_closebusiness" = "Learned Stance on the Policy",
                      "learneddum2_who" = "Learned Stance on the Policy",
                             "maskspublic_you2_pre" = "Support for Covid Policy Pre",
                             "closebusiness_you2_pre" = "Support for Covid Policy Pre",
                             "who_you2_pre" = "Support for Covid Policy Pre",
                       "vote_trump_prep5" = "Lagged DV", 
           "learneddum2_masks:maskspublic_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_closebusiness:closebusiness_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_who:who_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_masks:vote_trump_prep5"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_closebusiness:vote_trump_prep5"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_who:vote_trump_prep5"="Learned Stance on the Policy X Lagged DV",
                              "pidscale_pre" = "Partisanship Scale",
        "blacks_pre" = "Attitudes about Aiding Blacks",
        "immigration_pre" = "Attitudes about Immigration",
        "redistribution_pre" = "Attitudes about Redistribution",
        "healthcare_pre" = "Attitudes about Healthcare",
        "environment_pre" = "Attitudes about Environment",
        "abortion_pre" = "Attitudes about Abortion") )  %>%
  
  footnote("This table shows the results of separately regressing November vote on August vote (the lagged dependent variable), an indicator variable (0/1) for whether they learned the candidate stances on each of these issues, their attitude on that issue in August (0/1, relative measure), and the relevant interactions. Trump vote coded Biden 0, 0.5 Other/No vote, and Trump 1. The number of observations varies across the regressions because the number of respondents who don't know the stances in August varies.",
    footnote_as_chunk = T ,
    escape = F, threeparttable = TRUE
  )  %>% 
    add_header_above(c(" " = 1, "DV: Vote for Trump"=3)) %>% 
  kable_styling(font_size = 9,latex_options="HOLD_position")
```

```{r leadbyissuereglearningTrumpRatings,echo=FALSE,cache=F,results='asis',message=FALSE,warning=FALSE,include=T}

dat$learneddum2_masks <- ifelse(dat$maskspublic_cand_pre==0& 
                                     dat$maskspublic_cand_post==1,1,0) 
dat$learneddum2_closebusiness<-ifelse(dat$closebusiness_cand_pre==0&
                                        dat$closebusiness_cand_post==1,1,0) 
dat$learneddum2_who <- ifelse(dat$who_cand_pre==0&dat$who_cand_post==1,1,0) 

#Data for regressions
dreg <- dat  %>% 
  dplyr::select(trumpbiden_pre,trumpbiden_post,maskspublic_cand_pre,maskspublic_cand_post,
                closebusiness_cand_pre,closebusiness_cand_post,
                who_cand_pre,who_cand_post,
                learneddum2_masks,learneddum2_closebusiness,learneddum2_who,
                maskspublic_you2_post,closebusiness_you2_post,who_you2_post,
                maskspublic_you2_pre,closebusiness_you2_pre,who_you2_pre)

models <- list(
  "Mandatory Masks"     
  = lm(trumpbiden_post~learneddum2_masks*maskspublic_you2_pre+learneddum2_masks*trumpbiden_pre,
               data = subset(dreg,maskspublic_cand_pre==0&maskspublic_cand_post==1|
                  maskspublic_cand_pre==0&maskspublic_cand_post==0) ),
  "Close Businesses"     
  = lm(trumpbiden_post~learneddum2_closebusiness*closebusiness_you2_pre+learneddum2_closebusiness*trumpbiden_pre,
               data = subset(dreg,closebusiness_cand_pre==0&closebusiness_cand_post==1|
                  closebusiness_cand_pre==0&closebusiness_cand_post==0)),
  "WHO Membership"     
  = lm(trumpbiden_post~learneddum2_who*who_you2_pre+learneddum2_who*trumpbiden_pre,
               data = subset(dreg,who_cand_pre==0&who_cand_post==1|
                  who_cand_pre==0&who_cand_post==0))
)
cap = "Does Learning Lead to Shifting Away from Trump on Three Coronavirus Policy Issues---Comparison to Those Who Never Learn. Each column shows a separate least-squares regression with standard errors in parentheses." 
modelsummary(models,gof_omit="BIC|AIC|F|Log.Lik.|RMSE|R2 Adj.|Std.Errors",output = 'kableExtra',stars = F, statistic = 'conf.int',title = cap, vcov = "HC3",coef_rename = c("learneddum2_masks" = "Learned Stance on the Policy", 
                             "learneddum2_closebusiness" = "Learned Stance on the Policy",
                             "learneddum2_who" = "Learned Stance on the Policy",
                             "trumpbiden_pre" = "Lagged DV", 
           "learneddum2_masks:maskspublic_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_closebusiness:closebusiness_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_who:who_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_masks:trumpbiden_pre"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_closebusiness:trumpbiden_pre"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_who:trumpbiden_pre"="Learned Stance on the Policy X Lagged DV",
                             "maskspublic_you2_pre" = "Support for Covid Policy Pre",
                             "closebusiness_you2_pre" = "Support for Covid Policy Pre",
                             "who_you2_pre" = "Support for Covid Policy Pre") )  %>%
  footnote("This table shows the results of separately regressing November relative candidate ratings on August ratings (the lagged dependent variable), an indicator variable (0/1) for whether they learned the candidate stances on each issue (0/1, relative measure), their attitude on  each respective issue in August, and the relevant interactions. All variables coded 0-1. The number of observations varies across the regressions because the number of respondents who don't know the stances in August varies.",
    footnote_as_chunk = T ,
    escape = F, threeparttable = TRUE
  )  %>% 
    add_header_above(c(" " = 1, "DV: Relative Candidate Ratings"=3)) %>% 
  kable_styling(font_size = 9,latex_options="HOLD_position")
```

```{r leadbyissuereglearningRatings,echo=FALSE,cache=F,results='asis',message=FALSE,warning=FALSE,include=T}

dat$learneddum2_masks <- ifelse(dat$maskspublic_cand_pre==0& 
                                     dat$maskspublic_cand_post==1,1,0) 
dat$learneddum2_closebusiness<-ifelse(dat$closebusiness_cand_pre==0&
                                        dat$closebusiness_cand_post==1,1,0) 
dat$learneddum2_who <- ifelse(dat$who_cand_pre==0&dat$who_cand_post==1,1,0) 

#Data for regressions
dreg <- dat  %>% 
  dplyr::select(trumpbiden_pre,trumpbiden_post,maskspublic_cand_pre,maskspublic_cand_post,
                closebusiness_cand_pre,closebusiness_cand_post,
                who_cand_pre,who_cand_post,
                learneddum2_masks,learneddum2_closebusiness,learneddum2_who,
                maskspublic_you2_post,closebusiness_you2_post,who_you2_post,
                maskspublic_you2_pre,closebusiness_you2_pre,who_you2_pre)

models <- list(
  "Mandatory Masks"     
  = lm(trumpbiden_post~learneddum2_masks*maskspublic_you2_pre+learneddum2_masks*trumpbiden_pre,
               data = subset(dreg,maskspublic_cand_pre==0&maskspublic_cand_post==1|
                  maskspublic_cand_pre==0&maskspublic_cand_post==0) ),
  "Close Businesses"     
  = lm(trumpbiden_post~learneddum2_closebusiness*closebusiness_you2_pre+learneddum2_closebusiness*trumpbiden_pre,
               data = subset(dreg,closebusiness_cand_pre==0&closebusiness_cand_post==1|
                  closebusiness_cand_pre==0&closebusiness_cand_post==0)),
  "WHO Membership"     
  = lm(trumpbiden_post~learneddum2_who*who_you2_pre+learneddum2_who*trumpbiden_pre,
               data = subset(dreg,who_cand_pre==0&who_cand_post==1|
                  who_cand_pre==0&who_cand_post==0))
)
cap = "Does Learning Lead to Shifting Away from Trump on Three Coronavirus Policy Issues---Comparison to Those Who Never Learn. Each column shows a separate least-squares regression with standard errors in parentheses." 
modelsummary(models,gof_omit="BIC|AIC|F|Log.Lik.|RMSE|R2 Adj.|Std.Errors",output = 'kableExtra',stars = F,statistic = 'conf.int',title = cap, vcov = "HC3",coef_rename = c("learneddum2_masks" = "Learned Stance on the Policy", 
                             "learneddum2_closebusiness" = "Learned Stance on the Policy",
                             "learneddum2_who" = "Learned Stance on the Policy",
                             "trumpbiden_pre" = "Lagged DV", 
           "learneddum2_masks:maskspublic_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_closebusiness:closebusiness_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_who:who_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_masks:trumpbiden_pre"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_closebusiness:trumpbiden_pre"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_who:trumpbiden_pre"="Learned Stance on the Policy X Lagged DV",
                             "maskspublic_you2_pre" = "Support for Covid Policy Pre",
                             "closebusiness_you2_pre" = "Support for Covid Policy Pre",
                             "who_you2_pre" = "Support for Covid Policy Pre") )  %>%
  footnote("This table shows the results of separately regressing November (post-election) candidate ratings on August (post-election) candidate ratings (the lagged dependent variable), an indicator variable (0/1) for whether they learned the candidate stances on each issue (0/1, relative measure), their attitude on each respective issue in August, and the relevant interactions. All variables coded 0-1. The number of observations varies across the regressions because the number of respondents who don't know the stances in August varies.",
    footnote_as_chunk = T ,
    escape = F, threeparttable = TRUE
  )  %>% 
    add_header_above(c(" " = 1, "DV: Relative Candidate Ratings"=3)) %>% 
  kable_styling(font_size = 9,latex_options="HOLD_position")
```

```{r leadbyissuereglearningTrumpcontrolsRatings,echo=FALSE,cache=F,results='asis',message=FALSE,warning=FALSE,include=T}

dat$learneddum2_masks <- ifelse(dat$maskspublic_cand_pre==0& 
                                     dat$maskspublic_cand_post==1,1,0) 
dat$learneddum2_closebusiness<-ifelse(dat$closebusiness_cand_pre==0&
                                        dat$closebusiness_cand_post==1,1,0) 
dat$learneddum2_who <- ifelse(dat$who_cand_pre==0&dat$who_cand_post==1,1,0) 

#Data for regressions
dreg <- dat  %>%   filter(vote_pre=="Trump") %>%  
  dplyr::select(trumpbiden_pre,trumpbiden_post,maskspublic_cand_pre,maskspublic_cand_post,
                closebusiness_cand_pre,closebusiness_cand_post,
                who_cand_pre,who_cand_post,
                learneddum2_masks,learneddum2_closebusiness,learneddum2_who,
                maskspublic_you2_post,closebusiness_you2_post,who_you2_post,
                maskspublic_you2_pre,closebusiness_you2_pre,who_you2_pre)

models <- list(
  "Mandatory Masks"     
  = lm(trumpbiden_post~learneddum2_masks*maskspublic_you2_pre+learneddum2_masks*trumpbiden_pre,
               data = subset(dreg,maskspublic_cand_pre==0&maskspublic_cand_post==1|
                  maskspublic_cand_pre==0&maskspublic_cand_post==0) ),
  "Close Businesses"     
  = lm(trumpbiden_post~learneddum2_closebusiness*closebusiness_you2_pre+learneddum2_closebusiness*trumpbiden_pre,
               data = subset(dreg,closebusiness_cand_pre==0&closebusiness_cand_post==1|
                  closebusiness_cand_pre==0&closebusiness_cand_post==0)),
  "WHO Membership"     
  = lm(trumpbiden_post~learneddum2_who*who_you2_pre+learneddum2_who*trumpbiden_pre,
               data = subset(dreg,who_cand_pre==0&who_cand_post==1|
                  who_cand_pre==0&who_cand_post==0))
)
cap = "Does Learning Lead to Shifting Away from Trump on Three Coronavirus Policy Issues---Comparison to Those Who Never Learn. Each column shows a separate least-squares regression with standard errors in parentheses." 
modelsummary(models,gof_omit="BIC|AIC|F|Log.Lik.|RMSE|R2 Adj.|Std.Errors",output = 'kableExtra',stars = F,statistic = 'conf.int',title = cap, vcov = "HC3",coef_rename = c("learneddum2_masks" = "Learned Stance on the Policy", 
                             "learneddum2_closebusiness" = "Learned Stance on the Policy",
                             "learneddum2_who" = "Learned Stance on the Policy",
                             "trumpbiden_pre" = "Lagged DV", 
           "learneddum2_masks:maskspublic_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_closebusiness:closebusiness_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_who:who_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_masks:trumpbiden_pre"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_closebusiness:trumpbiden_pre"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_who:trumpbiden_pre"="Learned Stance on the Policy X Lagged DV",
                             "maskspublic_you2_pre" = "Support for Covid Policy Pre",
                             "closebusiness_you2_pre" = "Support for Covid Policy Pre",
                             "who_you2_pre" = "Support for Covid Policy Pre") )  %>%
  footnote("This table shows the results of separately regressing November (post-election) candidate ratings on August (post-election) candidate ratings (the lagged dependent variable), an indicator variable (0/1) for whether they learned the candidate stances on each issue (0/1, relative measure), their attitude on each respective issue in August, and the relevant interactions. All variables coded 0-1. The number of observations varies across the regressions because the number of respondents who don't know the stances in August varies.",
    footnote_as_chunk = T ,
    escape = F, threeparttable = TRUE
  )  %>% 
    add_header_above(c(" " = 1, "DV: Relative Candidate Ratings"=3)) %>% 
  kable_styling(font_size = 9.5,latex_options="HOLD_position")
```

```{r leadbyissuereglearningcontrolsRatings,echo=FALSE,cache=F,results='asis',message=FALSE,warning=FALSE,include=T}

dat$learneddum2_masks <- ifelse(dat$maskspublic_cand_pre==0& 
                                     dat$maskspublic_cand_post==1,1,0) 
dat$learneddum2_closebusiness<-ifelse(dat$closebusiness_cand_pre==0&
                                        dat$closebusiness_cand_post==1,1,0) 
dat$learneddum2_who <- ifelse(dat$who_cand_pre==0&dat$who_cand_post==1,1,0) 

#Data for regressions
dreg <- dat  %>% 
  dplyr::select(trumpbiden_pre,trumpbiden_post,maskspublic_cand_pre,maskspublic_cand_post,
                closebusiness_cand_pre,closebusiness_cand_post,
                who_cand_pre,who_cand_post,
                learneddum2_masks,learneddum2_closebusiness,learneddum2_who,
                maskspublic_you2_post,closebusiness_you2_post,who_you2_post,
                maskspublic_you2_pre,closebusiness_you2_pre,who_you2_pre)

models <- list(
  "Mandatory Masks"     
  = lm(trumpbiden_post~learneddum2_masks*maskspublic_you2_pre+learneddum2_masks*trumpbiden_pre,
               data = subset(dreg,maskspublic_cand_pre==0&maskspublic_cand_post==1|
                  maskspublic_cand_pre==0&maskspublic_cand_post==0) ),
  "Close Businesses"     
  = lm(trumpbiden_post~learneddum2_closebusiness*closebusiness_you2_pre+learneddum2_closebusiness*trumpbiden_pre,
               data = subset(dreg,closebusiness_cand_pre==0&closebusiness_cand_post==1|
                  closebusiness_cand_pre==0&closebusiness_cand_post==0)),
  "WHO Membership"     
  = lm(trumpbiden_post~learneddum2_who*who_you2_pre+learneddum2_who*trumpbiden_pre,
               data = subset(dreg,who_cand_pre==0&who_cand_post==1|
                  who_cand_pre==0&who_cand_post==0))
)
cap = "Does Learning Lead to Shifting Away from Trump on Three Coronavirus Policy Issues---Comparison to Those Who Never Learn. Each column shows a separate least-squares regression with standard errors in parentheses." 
modelsummary(models,gof_omit="BIC|AIC|F|Log.Lik.|RMSE|R2 Adj.|Std.Errors",output = 'kableExtra',stars = F, statistic = 'conf.int',title = cap, vcov = "HC3",coef_rename = c("learneddum2_masks" = "Learned Stance on the Policy", 
                             "learneddum2_closebusiness" = "Learned Stance on the Policy",
                             "learneddum2_who" = "Learned Stance on the Policy",
                             "trumpbiden_pre" = "Lagged DV", 
           "learneddum2_masks:maskspublic_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_closebusiness:closebusiness_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_who:who_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_masks:trumpbiden_pre"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_closebusiness:trumpbiden_pre"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_who:trumpbiden_pre"="Learned Stance on the Policy X Lagged DV",
                             "maskspublic_you2_pre" = "Support for Covid Policy Pre",
                             "closebusiness_you2_pre" = "Support for Covid Policy Pre",
                             "who_you2_pre" = "Support for Covid Policy Pre") )  %>%
  footnote("This table shows the results of separately regressing November (post-election) candidate ratings on August (post-election) candidate ratings (the lagged dependent variable), an indicator variable (0/1) for whether they learned the candidate stances on each issue (0/1, relative measure), their attitude on each respective issue in August, and the relevant interactions. All variables coded 0-1. The number of observations varies across the regressions because the number of respondents who don't know the stances in August varies.",
    footnote_as_chunk = T ,
    escape = F, threeparttable = TRUE
  )  %>% 
    add_header_above(c(" " = 1, "DV: Relative Candidate Ratings"=3)) %>% 
  kable_styling(font_size = 9,latex_options="HOLD_position")
```

```{r leadbyissuereglearningAllcontrols,echo=FALSE,cache=F,results='asis',message=FALSE,warning=FALSE,include=T}

dat$learneddum2_masks <- ifelse(dat$maskspublic_cand_pre==0& 
                                     dat$maskspublic_cand_post==1,1,0) 
dat$learneddum2_closebusiness<-ifelse(dat$closebusiness_cand_pre==0&
                                        dat$closebusiness_cand_post==1,1,0) 
dat$learneddum2_who <- ifelse(dat$who_cand_pre==0&dat$who_cand_post==1,1,0) 

#Data for regressions
dreg <- dat  %>% 
  dplyr::select(vote_trump_postp5,vote_trump_prep5,maskspublic_cand_pre,maskspublic_cand_post,
                closebusiness_cand_pre,closebusiness_cand_post,
                who_cand_pre,who_cand_post,
                learneddum2_masks,learneddum2_closebusiness,learneddum2_who,
                maskspublic_you2_post,closebusiness_you2_post,who_you2_post,
                maskspublic_you2_pre,closebusiness_you2_pre,who_you2_pre,pidscale_pre,blacks_pre,
                  immigration_pre,redistribution_pre,healthcare_pre,environment_pre,abortion_pre)

models <- list(
  "Mandatory Masks"     
  = lm(vote_trump_postp5~learneddum2_masks*maskspublic_you2_pre+learneddum2_masks*vote_trump_prep5+
         pidscale_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,
               data = dreg),
  "Close Businesses"     
  = lm(vote_trump_postp5~learneddum2_closebusiness*closebusiness_you2_pre+learneddum2_closebusiness*vote_trump_prep5+
         pidscale_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,
               data = dreg),
  "WHO Membership"     
  = lm(vote_trump_postp5~learneddum2_who*who_you2_pre+learneddum2_who*vote_trump_prep5+pidscale_pre+blacks_pre+
         immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,
               data = dreg)
)
cap = "Does Learning Lead to Voting on Three Coronavirus Policy Issues---Comparison to All Other Respondents. Each column shows a separate least-squares regression." 
modelsummary(models,gof_omit="BIC|AIC|F|Log.Lik.|RMSE|R2 Adj.|Std.Errors",output = 'kableExtra',stars = F,statistic = 'conf.int',title = cap, vcov = "HC3",coef_rename = c("learneddum2_masks" = "Learned Stance on the Policy", 
                      "learneddum2_closebusiness" = "Learned Stance on the Policy",
                      "learneddum2_who" = "Learned Stance on the Policy",
                             "maskspublic_you2_pre" = "Support for Covid Policy Pre",
                             "closebusiness_you2_pre" = "Support for Covid Policy Pre",
                             "who_you2_pre" = "Support for Covid Policy Pre",
                       "vote_trump_prep5" = "Lagged DV", 
           "learneddum2_masks:maskspublic_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_closebusiness:closebusiness_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_who:who_you2_pre"="Learned Stance on the Policy X Support for Covid Policy Pre",
           "learneddum2_masks:vote_trump_prep5"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_closebusiness:vote_trump_prep5"="Learned Stance on the Policy X Lagged DV",
           "learneddum2_who:vote_trump_prep5"="Learned Stance on the Policy X Lagged DV",
                              "pidscale_pre" = "Partisanship Scale",
        "blacks_pre" = "Attitudes about Aiding Blacks",
        "immigration_pre" = "Attitudes about Immigration",
        "redistribution_pre" = "Attitudes about Redistribution",
        "healthcare_pre" = "Attitudes about Healthcare",
        "environment_pre" = "Attitudes about Environment",
        "abortion_pre" = "Attitudes about Abortion") )  %>%
  
  footnote("This table shows the results of separately regressing November vote on August vote (the lagged dependent variable), an indicator variable (0/1) for whether they learned the candidate stances on each issue, their attitude on that issue in August (relative measure), and the relevant interactions. Trump vote coded Biden 0, 0.5 Other/No vote, and Trump 1. The number of observations varies across the regressions because the number of respondents who don't know the stances in August varies.",
    footnote_as_chunk = T ,
    escape = F, threeparttable = TRUE
  )  %>% 
    add_header_above(c(" " = 1, "DV: Vote for Trump"=3)) %>% 
  kable_styling(font_size = 8,latex_options="HOLD_position")
```

```{r regTrumpDisa,message = F, warning = F, include = T, echo=F,cache = T,fig.height=8,fig.width=7.9,fig.cap="Regressions exploring whether initial Trump voters shift away from him because of their Covid views. Using our six-item Covid policy scale, this figure presents regressions of post-election vote choice and relative candidate ratings on the August Covid policy scale. In the vote choice models, post-election vote choice is coded Trump 1, Biden or other 0, and non-votes 0.5. The minimal control models include the seven-point party identification scale. The full control models include the seven-point party identification and the six other non-Covid policy scales. The models with relative candidate ratings as the dependent variable also include lagged candidate ratings.  68 percent and 95 percent confidence intervals shown. Ns are for the vote regressions."}
t <- data.frame(matrix(ncol = 6, nrow = 1)) 
colnames(t) <- c('i','title','b','se','heading')

dregv <- dat %>% 
  filter(vote_pre=="Trump") %>%  
  dplyr::select(vote_trump_postp5,coronavirus_pre,pidscale_pre,blacks_pre,immigration_pre,redistribution_pre,
                healthcare_pre,environment_pre,abortion_pre,attention1_post,attention2_post,
                attention3_post,learneddum_masks,learneddum_closebusiness,learneddum_who,learned_index,learned_index2,coronavirus_test_post)
dregr<- dat %>% 
  filter(vote_pre=="Trump") %>% 
  dplyr::select(trumpbiden_pre,trumpbiden_post,coronavirus_pre,pidscale_pre,blacks_pre,immigration_pre,redistribution_pre,
                healthcare_pre,environment_pre,abortion_pre,attention1_post,attention2_post,attention3_post,learneddum_masks,
                learneddum_closebusiness,learneddum_who,learned_index,coronavirus_test_post,learned_index2)
 
# Filter data for those who voted for Trump in the first wave
# trump_voters <- dat %>% filter(vote_pre == "Trump" &coronavirustesting_pre>.5&protectcoronavirus_pre>.5)
# 
# # Create a summary table
# summary_table <- trump_voters %>%
#   group_by(closebusiness_you_pre, closebusiness_biden_post) %>%
#   summarise(
#     total_voters = n(),
#     trump_voters_post = sum(vote_post == "Trump"),
#     percent_trump_post = (trump_voters_post / total_voters) * 100
#   )
# 
# # Print the summary table
# print(summary_table)


j<-1;i<-1;

#Covid All Trump supporters
j<-j+1.2;i<-i+1;t[i,'i']<-j-.2;t[i,'heading']<-"Covid Scale Effects"
i<-i+1;t[i,'i']<-j+.1;t[i,'subt']<-"Vote with minimal controls"
m<-dregv%>%with(lm(vote_trump_postp5~coronavirus_pre+pidscale_pre))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.2;t[i,'subt']<-"Vote with full controls";t[i,'title']<-paste0("All initial Trump voters (N=",length(m$residual),")");
    m<-lm(vote_trump_postp5~coronavirus_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,dregv)
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.3;t[i,'subt']<-"Ratings with minimal controls"
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+pidscale_pre,dregr)
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.4;t[i,'subt']<-"Ratings with full controls"
    m<-lm(trumpbiden_post~coronavirus_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre+trumpbiden_pre,dregr)
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
 
#Learned 1+/3 or 3/3 Covid stances whether Biden and/or Trump placements moved in the right direction - first measure
j<-j+1;i<-i+1;t[i,'i']<-j+.1;
    m<-lm(vote_trump_postp5~coronavirus_pre+pidscale_pre,subset(dregv,learned_index>=1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.2;t[i,'title']<-paste0("Learned 1+/3 Covid stances (right direction, N=",length(m$residuals),")");
    m<-lm(vote_trump_postp5~coronavirus_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,subset(dregv,learned_index>=1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.3;
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+pidscale_pre,subset(dregr,learned_index>=1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.4;
    m<-lm(trumpbiden_post~coronavirus_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre+trumpbiden_pre,subset(dregr,learned_index>=1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
    
#Learned second measure   
j<-j+1;i<-i+1;t[i,'i']<-j+.1;
    m<-lm(vote_trump_postp5~coronavirus_pre+pidscale_pre,subset(dregv,learned_index2>=1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.2;t[i,'title']<-paste0("Learned 1+/3 Covid stances (relative measure, N=",length(m$residuals),")");
    m<-lm(vote_trump_postp5~coronavirus_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,subset(dregv,learned_index2>=1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.3;
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+pidscale_pre,subset(dregr,learned_index2>=1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.4;
    m<-lm(trumpbiden_post~coronavirus_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre+trumpbiden_pre,subset(dregr,learned_index2>=1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]

#interactions mentioned in text
# summary(lm(trumpbiden_post~coronavirus_pre*learned_index+trumpbiden_pre+pidscale_pre,dregr))
# summary(lm(trumpbiden_post~coronavirus_pre*learned_index+trumpbiden_pre*learned_index+pidscale_pre*learned_index,dregr))
# summary(lm(trumpbiden_post~coronavirus_pre*learned_index2+trumpbiden_pre*learned_index2+pidscale_pre*learned_index2,dregr))
# summary(lm(trumpbiden_post~coronavirus_pre*learned_index2+trumpbiden_pre+pidscale_pre,dregr))
    
#attention check
j<-j+1;i<-i+1;t[i,'i']<-j+.1;
    m<-lm(vote_trump_postp5~coronavirus_pre+pidscale_pre,subset(dregv,attention2_post==1&attention3_post==1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.2;t[i,'title']<-paste0("Passed two additional attention checks (N=",length(m$residuals),")");
    m<-lm(vote_trump_postp5~coronavirus_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,subset(dregv,attention2_post==1&attention3_post==1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.3;
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+pidscale_pre,subset(dregr,attention2_post==1&attention3_post==1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.4;
    m<-lm(trumpbiden_post~coronavirus_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre+trumpbiden_pre,subset(dregr,attention2_post==1&attention3_post==1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
    
#policy moderate
dat$policy_pre <- rowSums(cbind(dat$blacks_pre,dat$immigration_pre,dat$redistribution_pre,dat$healthcare_pre,dat$environment_pre,dat$abortion_pre), na.rm=TRUE)
  mp<-mean(dat$policy_pre, na.rm=TRUE) #  mean among all respondents
  sdp<-sd(dat$policy_pre, na.rm=TRUE) #  sd among all respondents
#calculate policy average for Trump voters
policy_pre <- rowSums(cbind(dregv$blacks_pre,dregv$immigration_pre,dregv$redistribution_pre,dregv$healthcare_pre,dregv$environment_pre,dregv$abortion_pre), na.rm=TRUE)

j<-j+1;i<-i+1;t[i,'i']<-j+.1;
    m<-lm(vote_trump_postp5~coronavirus_pre+pidscale_pre,subset(dregv,policy_pre>mp-sdp*1&policy_pre<mp+sdp*1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.2;t[i,'title']<-paste0("Policy moderates (N=",length(m$residuals),")");
    m<-lm(vote_trump_postp5~coronavirus_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,subset(dregv,policy_pre>mp-sdp*1&policy_pre<mp+sdp*1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.3;
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+pidscale_pre,subset(dregr,policy_pre>mp-sdp*1&policy_pre<mp+sdp*1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.4;
    m<-lm(trumpbiden_post~coronavirus_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre+trumpbiden_pre, subset(dregr,policy_pre>mp-sdp*1&policy_pre<mp+sdp*1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
    
#Positive test    
j<-j+1;i<-i+1;t[i,'i']<-j+.1;
    m<-lm(vote_trump_postp5~coronavirus_pre+pidscale_pre,subset(dregv,coronavirus_test_post==1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.2;t[i,'title']<-paste0("Positive test post (N=",length(m$residuals),")");
    m<-lm(vote_trump_postp5~coronavirus_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,subset(dregv,coronavirus_test_post==1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.3;
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+pidscale_pre,subset(dregr,coronavirus_test_post==1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.4;
    m<-lm(trumpbiden_post~coronavirus_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre+trumpbiden_pre,subset(dregr,coronavirus_test_post==1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]

#stats::cor(dregr,use = "na.or.complete")

top<- .5; #top of coefficient range
bottom <- -1; #bottom of the range
ccr<-t[,'b'] #coefficients
ser<-t[,'se']; #standard errors
par(mfrow=c(1,1),mar=c(4,0,0,0)); #number of panels and margins
case <-t[,'title'];
idx<-max(t[,'i'],na.rm = T)- t[,'i'] 

plot(c(ccr+1.96*ser,ccr-1.96*ser),c(idx*1.05,idx*1.05),xlim=c(bottom,top),main="",ylab="",xlab="",type="n",axes=F,cex.axis=.5);axis(1);
abline(v=0,lty=2); #gray line at zero
idx<-idx;points(ccr,idx,pch=1,cex=1,col=1);segments(ccr+1.96*ser,idx,ccr-1.96*ser,idx,lwd=1);segments(ccr+ser,idx,ccr-ser,idx,lwd=2);
mtext("Effect of Policy Scales on Vote or on Ratings of Trump vs Biden",side=1,line=2,cex=.7);
text(-1.05,idx-.05,case,cex=.7,pos = 4);  text(.435,idx+.01,t[,'subt'] ,cex=.5); text(-1.05,idx,t[,'heading'] ,cex=.9,pos = 4);
```

```{r reg,message = F, warning = F, include = T, echo=F,cache = T,fig.height=7.7,fig.width=7.5,fig.cap= "Regressions exploring whether all voters shifted votes because of their Covid views.  Using our six-item Covid policy scale, this figure presents regressions of post-election vote choice and relative candidate ratings on the August Covid policy scale. In the vote choice models, post-election vote choice is coded Trump 1, Biden or other 0, and non-votes 0.5. The minimal control models include the seven-point party identification scale. The full control models include the seven-point party identification and the six other non-Covid policy scales. All models include the lagged dependent variable. Biden or other 0, and Non-Votes 0.5. 68 percent and 95 percent confidence intervals shown. Ns are for the vote regressions."}
t <- data.frame(matrix(ncol = 6, nrow = 1))   
colnames(t) <- c('i','title','b','se','heading')

dregv<- dat %>% 
  dplyr::select(vote_pre,vote_trump_postp5,coronavirus_pre,pidscale_pre,blacks_pre,immigration_pre,
                redistribution_pre,healthcare_pre,environment_pre,abortion_pre,coronavirus_test_post,learned_index,learned_index2)
dregr<- dat %>% 
  dplyr::select(trumpbiden_pre,trumpbiden_post,coronavirus_pre,pidscale_pre,blacks_pre,immigration_pre,
                redistribution_pre,healthcare_pre,environment_pre,abortion_pre,coronavirus_test_post,learned_index,learned_index2)
dregv$vote_pre[is.na(dregv$vote_pre)]<-"Other" # Four respondents' no responses being treated as Other

j<-1;i<-1;
#Each Policy Scale Effects (Non Covid)
t[i,'i']<-j-.2;t[i,'heading']<-"Policy Scale Effects (Covid and Six Non-Covid Scales)"

#Covid
j<-j+1.2;i<-i+1;t[i,'i']<-j-.2;t[i,'heading']<-"Covid Scale Effects"
i<-i+1;t[i,'i']<-j+.1;t[i,'subt']<-"Vote with minimal controls"
    m<-dregv%>%with(lm(vote_trump_postp5~coronavirus_pre+factor(vote_pre)+pidscale_pre))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.2;t[i,'subt']<-"Vote with full controls";t[i,'title']<-paste0("All respondents (N=",length(m$residual),")");
    m<-lm(vote_trump_postp5~coronavirus_pre+factor(vote_pre)+.,dregv)
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.3;t[i,'subt']<-"Ratings with minimal controls"
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+pidscale_pre,dregr)
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.4;t[i,'subt']<-"Ratings with full controls"
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+.,dregr)
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
#Learners measure 1
j<-j+1;i<-i+1;t[i,'i']<-j+.1;
    m<-lm(vote_trump_postp5~coronavirus_pre+factor(vote_pre)+pidscale_pre,subset(dregv,learned_index>=1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.2;t[i,'title']<-paste0("Learned 1+/3 Covid stances (right direction, N=",length(m$residuals),")");
    m<-lm(vote_trump_postp5~coronavirus_pre+factor(vote_pre)+pidscale_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,
          subset(dregv,learned_index>=1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.3;
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+pidscale_pre,subset(dregr,learned_index>=1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.4;
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+pidscale_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,
          subset(dregr,learned_index>=1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
#Learners   measure 2
j<-j+1;i<-i+1;t[i,'i']<-j+.1;
    m<-lm(vote_trump_postp5~coronavirus_pre+factor(vote_pre)+pidscale_pre,subset(dregv,learned_index2>=1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.2;t[i,'title']<-paste0("Learned 1+/3 Covid stances (relative measure, N=",length(m$residuals),")");
    m<-lm(vote_trump_postp5~coronavirus_pre+factor(vote_pre)+pidscale_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,
          subset(dregv,learned_index2>=1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.3;
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+pidscale_pre,subset(dregr,learned_index2>=1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.4;
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+pidscale_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,
          subset(dregr,learned_index2>=1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]

 #interactions mentioned in text
# summary(lm(trumpbiden_post~coronavirus_pre*learned_index+trumpbiden_pre+pidscale_pre,dregr))
# summary(lm(trumpbiden_post~coronavirus_pre*learned_index+trumpbiden_pre*learned_index+pidscale_pre*learned_index,dregr))
# summary(lm(trumpbiden_post~coronavirus_pre*learned_index2+trumpbiden_pre+pidscale_pre,dregr))
# summary(lm(trumpbiden_post~coronavirus_pre*learned_index2+trumpbiden_pre*learned_index2+pidscale_pre*learned_index2,dregr))
#attention check
j<-j+1;i<-i+1;t[i,'i']<-j+.1;
    m<-lm(vote_trump_postp5~coronavirus_pre+vote_pre+pidscale_pre,subset(dregv,dat$attention2_post==1&dat$attention3_post==1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.2;t[i,'title']<-paste0("Passed two additional attention checks (N=",length(m$residuals),")");
    m<-lm(vote_trump_postp5~coronavirus_pre+pidscale_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,subset(dregv,dat$attention2_post==1&dat$attention3_post==1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.3;
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+pidscale_pre,subset(dregr,dat$attention2_post==1&dat$attention3_post==1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.4;
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+pidscale_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,subset(dregr,dat$attention2_post==1&dat$attention3_post==1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
#policy moderate
j<-j+1;i<-i+1;t[i,'i']<-j+.1;
    m<-lm(vote_trump_postp5~coronavirus_pre+vote_pre+pidscale_pre,subset(dregv,dat$policy_pre>mp-sdp&dat$policy_pre<mp+sdp))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.2;t[i,'title']<-paste0("Policy moderates (N=",length(m$residuals),")");
    m<-lm(vote_trump_postp5~coronavirus_pre+factor(vote_pre)+pidscale_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,subset(dregv,dat$policy_pre>mp-sdp&dat$policy_pre<mp+sdp))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.3;
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+pidscale_pre,subset(dregr,dat$policy_pre>mp-sdp&dat$policy_pre<mp+sdp))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.4;
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+pidscale_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,subset(dregr,dat$policy_pre>mp-sdp&dat$policy_pre<mp+sdp))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]

        
#Positive test    
j<-j+1;i<-i+1;t[i,'i']<-j+.1;
    m<-lm(vote_trump_postp5~coronavirus_pre+factor(vote_pre)+pidscale_pre,subset(dregv,coronavirus_test_post==1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.2;t[i,'title']<-paste0("Positive test post (N=",length(m$residuals),")");
    m<-lm(vote_trump_postp5~coronavirus_pre+factor(vote_pre)+pidscale_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,subset(dregv,dat$coronavirus_test_post==1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.3;
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+pidscale_pre,subset(dregr,coronavirus_test_post==1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
i<-i+1;t[i,'i']<-j+.4;
    m<-lm(trumpbiden_post~coronavirus_pre+trumpbiden_pre+pidscale_pre+blacks_pre+immigration_pre+redistribution_pre+healthcare_pre+environment_pre+abortion_pre,subset(dregr,coronavirus_test_post==1))
    t[i,'b']<-m$coefficients[2];t[i,'se']<-coef(summary(m))[2, 2]
    
#stats::cor(dregr,use = "na.or.complete")
top<- .5; #top of coefficient range
bottom <- -1; #bottom of the range
ccr<-t[,'b'] #coefficients
ser<-t[,'se']; #standard errors
par(mfrow=c(1,1),mar=c(4,0,0,0)); #number of panels and margins
case <-t[,'title'];
idx<-max(t[,'i'])- t[,'i'] 
plot(c(ccr+1.96*ser,ccr-1.96*ser),c(idx*1.03,idx*1.03),xlim=c(bottom,top),main="",ylab="",xlab="",type="n",axes=F,cex.axis=.5);axis(1);
abline(v=0,lty=2,col="gray"); #gray line at zero
idx<-idx;points(ccr,idx,pch=1,cex=1,col=1);segments(ccr+1.96*ser,idx,ccr-1.96*ser,idx,lwd=1);segments(ccr+ser,idx,ccr-ser,idx,lwd=2);
mtext("Effect of Policy Scales on Vote or on Ratings of Trump vs Biden",side=1,line=2,cex=.8);
text(-1.05,idx-.05,case,cex=.7,pos = 4);  text(.3,idx,t[,'subt'] ,cex=.5); text(-1.05,idx,t[,'heading'] ,cex=.9,pos = 4);
```

## Covid Views and Knowledge of Candidate Positions Among Biden Voters

```{r, agreeBiden,message = F, warning = F, include = T, echo=F,cache = T,echo=FALSE,fig.cap="Biden voters' views on Coronavirus policies and their knowledge of Trump and Biden's stances. This figure shows that most initial Biden voters agreed with Biden on the thrust of government policy."}
#First set of issues
wide_df <- dat %>% dplyr::select(coronavirustesting_pre, stayathome_pre, protectcoronavirus_pre,vote_pre)
long <- as.data.frame(pivot_longer(wide_df, cols = 1:3, names_to = 'youq', values_to = 'you'))

d <- long %>% filter(vote_pre=="Biden"& !is.na(you)) %>% group_by(youq,you) %>% 
  summarise(value=n()) %>%  mutate(percent=100*value/sum(value))%>%ungroup() 
d$youq[d$youq=='coronavirustesting_pre']<-'Coronavirus Testing'
d$youq[d$youq=='stayathome_pre']<-'Making People Stay at Home'
d$youq[d$youq=='protectcoronavirus_pre']<-'Protecting Against Coronavirus'
d$youq <- factor(d$youq)
d$you <- as.factor(d$you)
levels(d$you) <- c("--","-","=","+","++",NA)
d$percent_lab <- str_c(round(d$percent),"%")
d$y <- d$percent+4
a<-ggplot(d,aes(x=you,y=percent,label=percent_lab)) + 
  geom_bar(stat="identity",position="stack") +
  facet_wrap(~youq, nrow = 1)+xlab("") + ylab("Percent") +
  theme(text = element_text(size=9.75)) + 
  ggtitle("(a) How Much Effort Do You Want From the Federal Government on ...") + geom_text(mapping=aes(you,y,label=percent_lab),size=3)

#Second set
wide_df <- dat %>% dplyr::select(maskspublic_you_pre, closebusiness_you_pre, who_you_pre,vote_pre)
long <- as.data.frame(pivot_longer(wide_df, cols = 1:3, names_to = 'youq', values_to = 'you'))

d <- long %>% filter(vote_pre=="Trump" & !is.na(you)) %>% group_by(youq,you) %>% 
  summarise(value=n()) %>% ungroup()  %>% group_by(youq)  %>%  mutate(percent=100*value/sum(value))

d$youq[d$youq=='maskspublic_you_pre']<-'Mandatory Masks in Public'
d$youq[d$youq=='closebusiness_you_pre']<-'Close Non-Essential Businesses'
d$youq[d$youq=='who_you_pre']<-'WHO Membership'
d$youq <- factor(d$youq,levels = c('Mandatory Masks in Public','Close Non-Essential Businesses','WHO Membership'))


d <- d %>% group_by(youq,you) %>% mutate(percent_lab=sum(percent)) %>% mutate(tot=percent_lab,y=percent_lab+3.5,percent_lab=str_c(round(percent_lab),"%")) 

levels(d$you)[3]<-"Neutral"
d$you <- factor(d$you,levels=c("Disagree","Neutral","Agree"))  
b<-ggplot(d,aes(x=you,y=percent)) + 
  geom_bar(stat="identity",position="stack") +
  facet_wrap(~fct_relevel(youq,"Mandatory Masks in Public","Close Non-Essential Businesses","WHO Membership"), nrow = 1)+xlab("") + ylab("Percent")+ 
  theme(text = element_text(size=9.75),legend.position = "bottom",legend.margin=margin(c(1,1,1,1)))+ 
  ggtitle("(b) Respondent View on ...") + geom_text(mapping=aes(you,y=y,label=percent_lab),size=3)
 
grid.arrange(a,b,nrow=2,heights=c(1,1.1))


```

```{r, knowBiden,cache=T,fig.height=2.5,fig.width=6.5,fig.cap="Biden Voters' Knowledge of Trump and Biden's Stances by Biden supporters who disagreed with him on each Covid policy."}
# Knowledge variables
dat$kn_masks <- NA
dat$kn_masks[dat$maskspublic_trump2_pre<dat$maskspublic_biden2_pre] <- "B>T"
dat$kn_masks[dat$maskspublic_trump2_pre==dat$maskspublic_biden2_pre] <- "B=T"
dat$kn_masks[dat$maskspublic_trump2_pre>dat$maskspublic_biden2_pre] <- "T>B"
dat$kn_masks <- as.factor(dat$kn_masks)

dat$kn_business <- NA
dat$kn_business[dat$closebusiness_trump2_pre<dat$closebusiness_biden2_pre] <- "B>T"
dat$kn_business[dat$closebusiness_trump2_pre==dat$closebusiness_biden2_pre] <- "B=T"
dat$kn_business[dat$closebusiness_trump2_pre>dat$closebusiness_biden2_pre] <- "T>B"
dat$kn_business <- as.factor(dat$kn_business)

dat$kn_who <- NA
dat$kn_who[dat$who_trump2_pre<dat$who_biden2_pre] <- "B>T"
dat$kn_who[dat$who_trump2_pre==dat$who_biden2_pre] <- "B=T"
dat$kn_who[dat$who_trump2_pre>dat$who_biden2_pre] <- "T>B"
dat$kn_who <- as.factor(dat$kn_who)

wide_df <- dat %>% dplyr::select(kn_masks, kn_business, kn_who,vote_pre,maskspublic_you_pre,closebusiness_you_pre,who_you_pre)
long <- as.data.frame(pivot_longer(wide_df, cols = 1:3, names_to = 'knowq', values_to = 'know'))

# Only include those who disagreed with Biden (i.e. disagreed with policies)
long <- long %>% filter((knowq=="kn_masks" & maskspublic_you_pre=="Disagree") | (knowq=="kn_business" & closebusiness_you_pre=="Disagree") | (knowq=="kn_who" & who_you_pre=="Disagree"))
d <- long %>% filter(vote_pre=="Biden") %>% group_by(knowq,know) %>% 
  summarise(value=n()) %>% ungroup()  %>% group_by(knowq)  %>%  mutate(percent=100*value/sum(value))

d$knowq[d$knowq=='kn_masks']<-'Mandatory Masks in Public'
d$knowq[d$knowq=='kn_business']<-'Close Non-Essential Businesses'
d$knowq[d$knowq=='kn_who']<-'WHO Membership'
d$knowq <- factor(d$knowq,levels = c('Mandatory Masks in Public',
                                   'Close Non-Essential Businesses','WHO Membership'))


d <- d %>% mutate(y=percent+3,percent_lab=str_c(round(percent),"%")) 



d$know <- factor(d$know,levels=c("B>T","B=T","T>B"))
ggplot(d,aes(x=know,y=percent)) + 
  geom_bar(stat="identity",position="stack") +
  facet_wrap(vars(knowq), nrow = 1)+xlab("") + 
  ylab("")+ 
  theme(text = element_text(size=9.75),legend.position = "bottom",legend.margin=margin(c(1,1,1,1)))+
  geom_text(mapping=aes(know,y=y,label=percent_lab),size=3)

```


## Learning and Voting Analyses Among Biden Voters

```{r supplearnBiden,fig.height=2.5,fig.width=6.5, echo=FALSE, message = F, warning = F, include = T, cache = T,fig.cap="Learning category among initial Biden supporters who disagreed with Biden on each issue. This figure shows that many Biden voters who disagreed with him on Covid policy learned that they disagreed with him during the campaign."}
d1 <- dat %>% filter(vote_pre=="Biden" & !is.na(punished) & 
                       maskspublic_you_pre=="Disagree") %>% group_by(learned_masks) %>% 
  summarise(value=n()) %>% ungroup() %>% mutate(percent=100*value/sum(value))

d1$q <- "Mandatory Masks in Public"

d2 <- dat %>% filter(vote_pre=="Biden" & !is.na(punished) & closebusiness_you_pre=="Disagree") %>% group_by(learned_closebusiness)%>% summarise(value=n()) %>% ungroup() %>% mutate(percent=100*value/sum(value))
d2$q <- "Close Non-Essential Businesses"

d3 <- dat %>% filter(vote_pre=="Biden" & !is.na(punished) & 
                       who_you_pre=="Disagree") %>% group_by(learned_who)%>%
  summarise(value=n()) %>% ungroup() %>% mutate(percent=100*value/sum(value))
d3$q <- "WHO Membership"

d1<-rename(d1,learned=learned_masks);d2<-rename(d2,learned=learned_closebusiness);d3<-rename(d3,learned=learned_who)
d<-bind_rows(d1,d2,d3)

d <- d %>% group_by(learned,q) %>% mutate(z=percent+3)
d$percent_label <- as.character(round(d$percent))
d$percent_label <- str_c(d$percent_label,"%",sep=" ")

d$q <- factor(d$q,levels=c("Mandatory Masks in Public", "Close Non-Essential Businesses","WHO Membership"))

ggplot(d,aes(x=learned,y=percent)) + 
  geom_bar(stat="identity",position="stack") + scale_fill_grey(name="Punished") +
  facet_wrap(vars(q), nrow = 1)+xlab("") + ylab("Percent") + 
  theme(legend.position = "bottom",legend.margin=margin(c(1,1,1,1))) +
  geom_text(mapping=aes(learned,z,label=percent_label),colour="black", size =3)
```


```{r punishedBiden,cache=T,fig.height=6,fig.width=8,fig.cap="Percent of initial Biden supporters who disagreed with him on Covid policy and who shifted away from him by learning category. The figure shows that between 13 and 50 percent did so by not voting for him and between 27 and 50 percent did so by shifting their relative candidate ratings (i.e., becoming more favorable towards Trump)."}
dat$punished_vote_biden <-ifelse(dat$vote_pre=="Biden"&dat$vote_post_tot!="Biden",1,0)
#punished vote
d1 <- dat %>% filter(vote_pre=="Biden" & !is.na(punished_vote_biden) & maskspublic_you_pre=="Disagree") %>% # only includes people who disagreed with Biden
 group_by(punished_vote_biden,learned_masks) %>% summarise(value=n()) %>% ungroup() %>% group_by(learned_masks) %>% mutate(percent=100*value/sum(value))
d1$q <- "Mandatory Masks in Public"

d2 <- dat %>% filter(vote_pre=="Biden" & !is.na(punished_vote_biden) & closebusiness_you_pre=="Disagree") %>% group_by(punished_vote_biden,learned_closebusiness) %>% summarise(value=n()) %>% ungroup() %>% group_by(learned_closebusiness) %>% mutate(percent=100*value/sum(value))
d2$q <- "Close Non-Essential Businesses"

d3 <- dat %>% filter(vote_pre=="Biden" & !is.na(punished_vote_biden) & who_you_pre=="Disagree") %>% group_by(punished_vote_biden,learned_who) %>% summarise(value=n()) %>% ungroup() %>% group_by(learned_who) %>% mutate(percent=100*value/sum(value))
d3$q <- "WHO Membership"

d1<-rename(d1,learned=learned_masks);d2<-rename(d2,learned=learned_closebusiness);d3<-rename(d3,learned=learned_who)
d<-bind_rows(d1,d2,d3)

d <- d %>% group_by(learned,q) %>% mutate(y=percent+3) 
d$percent_label <- str_c(round(d$percent),"%")
d <- d %>% filter(punished_vote_biden==1)

levels(d$learned) <- c("Learned","Neither","Projected",NA)


a<-ggplot(d,aes(x=learned,y=percent)) + 
 geom_bar(stat="identity") +
 facet_wrap(~fct_relevel(q,"Mandatory Masks in Public","Close Non-Essential Businesses","WHO Membership"), nrow = 1)+xlab("") + ylab("Percent Shifted Vote Away from Biden") + 
 theme(legend.position = "bottom",legend.margin=margin(c(1,1,1,1))) + geom_text(mapping=aes(learned,y,label=percent_label),colour="black") + scale_x_discrete(drop=FALSE)

#punished ratings
masks <- dat %>% filter(vote_pre=="Biden" & maskspublic_you_pre=="Disagree") %>% dplyr::select(trumpbiden_change,learned_masks) %>% rename(learned=learned_masks) %>% mutate(q="Mandatory Masks in Public")
business <- dat %>% filter(vote_pre=="Biden" & closebusiness_you_pre=="Disagree") %>% dplyr::select(trumpbiden_change,learned_closebusiness) %>% rename(learned=learned_closebusiness) %>% mutate(q="Close Non-Essential Businesses")
who <- dat %>% filter(vote_pre=="Biden" & who_you_pre=="Disagree") %>% dplyr::select(trumpbiden_change,learned_who) %>% rename(learned=learned_who) %>% mutate(q="WHO Membership")

long <- masks %>% bind_rows(business,who) %>%
  drop_na()

labs <- long %>% group_by(learned,q) %>% summarise(punished=mean(trumpbiden_change>0)) %>% mutate(label=str_c(round(punished*100),"%"))



b<-ggplot(long, aes(learned,trumpbiden_change)) + geom_violin(scale='width') + facet_wrap(~fct_relevel(q,"Mandatory Masks in Public","Close Non-Essential Businesses","WHO Membership")) +
         geom_boxplot(width=0.6, color="grey", alpha=0.2) + xlab("") +ylab("Change in Trump minus Biden Ratings") + geom_label(data=labs,aes(learned,0.50,label=label))

grid.arrange(a,b,nrow=2)


```

## Coronavirus Policy Views by Race and Ethnicity {#race-ethnicity}
The following two figures consider whether support for policies to fight the coronavirus was equally high among different racial and ethnic groups. Figure \@ref(fig:covidrace) compares the views of Black and White respondents, while Figure \@ref(fig:covidhispanic) compares the views of respondents who are Hispanic to respondents who are not Hispanic. Both figures show that, prior to the 2020 election, there was strong support for policies to fight the coronavirus across ethnic and racial groups. 

```{r, covidrace,cache=T,fig.cap="Coronavirus policy views of black and white respondents"}
# Limit to Blacks and Whites
d <- dat %>% filter(race_pre %in% c("Black","White"))
d$race_pre <- droplevels(d$race_pre)

#First set of issues
wide_df <- d %>% dplyr::select(coronavirustesting_pre, stayathome_pre, protectcoronavirus_pre,vote_pre,race_pre)
long <- as.data.frame(pivot_longer(wide_df, cols = 1:3, names_to = 'youq', values_to = 'you'))

d <- long %>% filter(!is.na(you)) %>% group_by(youq,you,race_pre) %>% 
  summarise(value=n()) %>% ungroup() %>% group_by(race_pre,youq) %>% mutate(percent=100*value/sum(value)) %>% ungroup() 
d$youq[d$youq=='coronavirustesting_pre']<-'Coronavirus Testing'
d$youq[d$youq=='stayathome_pre']<-'Making People Stay at Home'
d$youq[d$youq=='protectcoronavirus_pre']<-'Protecting Against Coronavirus'
d$youq <- factor(d$youq)
d$you <- as.factor(d$you)
levels(d$you) <- c("--","-","=","+","++")
d$percent_lab <- str_c(round(d$percent),"%")
d$y <- d$percent+3
a<-ggplot(d,aes(x=you,y=percent,label=percent_lab,fill=race_pre)) + 
  geom_bar(stat="identity",position="dodge") +
  facet_wrap(vars(youq), nrow = 1)+xlab("") + ylab("Percent") +
  theme(text = element_text(size=9.75)) + 
  ggtitle("(a) How much effort do you want from the federal government on ...") + scale_fill_grey(name="Race") + theme(plot.title = element_text(size=10))

#Second set
d <- dat %>% filter(race_pre %in% c("Black","White"))
d$race_pre <- droplevels(d$race_pre)
wide_df <- d %>% dplyr::select(maskspublic_you_pre, closebusiness_you_pre, who_you_pre,vote_pre,race_pre)
long <- as.data.frame(pivot_longer(wide_df, cols = 1:3, names_to = 'youq', values_to = 'you'))

d <- long %>%   filter(!is.na(you)) %>% group_by(youq,you,race_pre) %>% 
  summarise(value=n()) %>% ungroup()  %>% group_by(race_pre,youq)  %>%  mutate(percent=100*value/sum(value))

d$youq[d$youq=='maskspublic_you_pre']<-'Mandatory Masks in Public'
d$youq[d$youq=='closebusiness_you_pre']<-'Closing Non-Essential Businesses'
d$youq[d$youq=='who_you_pre']<-'WHO Membership'
d$youq <- factor(d$youq,levels = c('Mandatory Masks in Public','Closing Non-Essential Businesses','WHO Membership'))

d <- d %>% group_by(youq,you) %>% mutate(percent_lab=sum(percent)) %>% mutate(tot=percent_lab,y=percent_lab+3,percent_lab=str_c(round(percent_lab),"%")) 

levels(d$you)[3]<-"Neutral"
d$you <- factor(d$you,levels=c("Disagree","Neutral","Agree"))
b<-ggplot(d,aes(x=you,y=percent,fill=race_pre)) + 
  geom_bar(stat="identity",position="dodge") +
  facet_wrap(vars(youq), nrow = 1)+xlab("") + ylab("Percent")+ 
  theme(text = element_text(size=9.75),legend.position = "bottom",legend.margin=margin(c(1,1,1,1)))+ 
  ggtitle("(b) Respondent view on ...") + scale_fill_grey(name="Race") + theme(plot.title = element_text(size=10))

grid.arrange(a,b,nrow=2,heights=c(1,1.1))
```


```{r,covidhispanic,cache=T,fig.cap="Coronavirus policy views of Hispanic and non-Hispanic respondents"}
#First set of issues
wide_df <- dat %>% dplyr::select(coronavirustesting_pre, stayathome_pre, protectcoronavirus_pre,vote_pre,hispanic_pre)
long <- as.data.frame(pivot_longer(wide_df, cols = 1:3, names_to = 'youq', values_to = 'you'))

d <- long %>% filter(!is.na(you)) %>% group_by(youq,you,hispanic_pre) %>% 
  summarise(value=n()) %>% ungroup() %>% group_by(hispanic_pre,youq) %>% mutate(percent=100*value/sum(value)) %>% ungroup() 
d$youq[d$youq=='coronavirustesting_pre']<-'Coronavirus Testing'
d$youq[d$youq=='stayathome_pre']<-'Making People Stay at Home'
d$youq[d$youq=='protectcoronavirus_pre']<-'Protecting Against Coronavirus'
d$youq <- factor(d$youq)
d$you <- as.factor(d$you)
levels(d$you) <- c("--","-","=","+","++")
d$percent_lab <- str_c(round(d$percent),"%")
levels(d$hispanic_pre) <- c("Not Hispanic","Hispanic")
d$y <- d$percent+3
a<-ggplot(d,aes(x=you,y=percent,label=percent_lab,fill=hispanic_pre)) + 
  geom_bar(stat="identity",position="dodge") +
  facet_wrap(vars(youq), nrow = 1)+xlab("") + ylab("Percent") +
  theme(text = element_text(size=9.75)) + 
  ggtitle("(a) How much effort do you want from the federal government on ...") + scale_fill_grey(name="Hispanic") + theme(plot.title = element_text(size=10))

#Second set
wide_df <- dat %>% dplyr::select(maskspublic_you_pre, closebusiness_you_pre, who_you_pre,vote_pre,hispanic_pre)
long <- as.data.frame(pivot_longer(wide_df, cols = 1:3, names_to = 'youq', values_to = 'you'))

d <- long %>%   filter(!is.na(you)) %>% group_by(youq,you,hispanic_pre) %>% 
  summarise(value=n()) %>% ungroup()  %>% group_by(hispanic_pre,youq)  %>%  mutate(percent=100*value/sum(value))

d$youq[d$youq=='maskspublic_you_pre']<-'Mandatory Masks in Public'
d$youq[d$youq=='closebusiness_you_pre']<-'Close Non-Essential Businesses'
d$youq[d$youq=='who_you_pre']<-'WHO Membership'
d$youq <- factor(d$youq,levels = c('Mandatory Masks in Public','Close Non-Essential Businesses','WHO Membership'))

d <- d %>% group_by(youq,you) %>% mutate(percent_lab=sum(percent)) %>% mutate(tot=percent_lab,y=percent_lab+3,percent_lab=str_c(round(percent_lab),"%")) 
levels(d$hispanic_pre) <- c("Not Hispanic","Hispanic")
levels(d$you)[3]<-"Neutral"
d$you <- factor(d$you,levels=c("Disagree","Neutral","Agree"))
b<-ggplot(d,aes(x=you,y=percent,fill=hispanic_pre)) + 
  geom_bar(stat="identity",position="dodge") +
  facet_wrap(vars(youq), nrow = 1)+xlab("") + ylab("Percent")+ 
  theme(text = element_text(size=9.75),legend.position = "bottom",legend.margin=margin(c(1,1,1,1)))+ 
  ggtitle("(b) Respondent view on ...") + scale_fill_grey(name="Hispanic") + theme(plot.title = element_text(size=10))

grid.arrange(a,b,nrow=2,heights=c(1,1.1))
```

\newpage

## Results Among Trump Supporters Who Disagreed with Trump in Both Survey Waves {#disagree-both}

**Learning Among Trump Voters Who Disagreed with Trump in Both Survey Waves**

```{r supplearn-disagreed-both,fig.height=2,fig.width=6.5, echo=FALSE, message = F, warning = F, include = T, cache = T, fig.cap="Learning category among initial Trump supporters who disagreed with Trump in both survey waves. This figure shows that many Trump voters who disagreed with him on Covid policy in both waves learned that they disagreed with him during the campaign."}
d1 <- dat %>% filter(vote_pre=="Trump" & !is.na(punished) & maskspublic_you_pre=="Agree" & maskspublic_you_post=="Agree") %>% group_by(learned_masks)%>% summarise(value=n()) %>% ungroup() %>% mutate(percent=100*value/sum(value))
d1$q <- "Mandatory Masks in Public"

d2 <- dat %>% filter(vote_pre=="Trump" & !is.na(punished) & closebusiness_you_pre=="Agree" & closebusiness_you_post=="Agree") %>% group_by(learned_closebusiness)%>% summarise(value=n()) %>% ungroup() %>% mutate(percent=100*value/sum(value))
d2$q <- "Close Non-Essential Businesses"

d3 <- dat %>% filter(vote_pre=="Trump" & !is.na(punished) & who_you_pre=="Agree" & who_you_post=="Agree") %>% group_by(learned_who)%>% summarise(value=n()) %>% ungroup() %>% mutate(percent=100*value/sum(value))
d3$q <- "WHO Membership"

d1<-rename(d1,learned=learned_masks);d2<-rename(d2,learned=learned_closebusiness);d3<-rename(d3,learned=learned_who)
d<-bind_rows(d1,d2,d3)

d <- d %>% group_by(learned,q) %>% mutate(z=percent+3)
d$percent_label <- as.character(round(d$percent))
d$percent_label <- str_c(d$percent_label,"%",sep=" ")

d$q <- factor(d$q,levels=c("Mandatory Masks in Public", "Close Non-Essential Businesses", "WHO Membership"))
ggplot(d,aes(x=learned,y=percent)) + 
 geom_bar(stat="identity",position="stack") + scale_fill_grey(name="Punished") +
 facet_wrap(vars(q), nrow = 1)+xlab("") + ylab("Percent") + 
 theme(legend.position = "bottom",legend.margin=margin(c(1,1,1,1))) + geom_text(mapping=aes(learned,z,label=percent_label),colour="black",size=3)

```



**Shifting away from Trump among Trump Supporters Who Disagreed with Trump in Both Survey Waves**
```{r punished-disagreed-both,fig.height=2,echo=FALSE,fig.width=8,cache=T,fig.cap="Percent of Trump supporters who disagreed with him on Covid policy in both waves who shifted away from him by learning category. It shows that only a minority of learners shifted away from Trump on each issue. Shifting away is also not consistently higher among learners, suggesting that Trump voters who shifted away from him did not do so because they learned they disagreed with him on each issue."}
d1 <- dat %>% filter(vote_pre=="Trump" & !is.na(punished) & maskspublic_you_pre=="Agree" & maskspublic_you_post=="Agree") %>% # excludes all but people who disagree with trump
 group_by(punished,learned_masks) %>% summarise(value=n()) %>% ungroup() %>% group_by(learned_masks) %>% mutate(percent=100*value/sum(value))
d1$q <- "Mandatory Masks in Public"

d2 <- dat %>% filter(vote_pre=="Trump" & !is.na(punished) & closebusiness_you_pre=="Agree" & closebusiness_you_post=="Agree") %>% group_by(punished,learned_closebusiness)%>% summarise(value=n()) %>% ungroup() %>% group_by(learned_closebusiness) %>% mutate(percent=100*value/sum(value))
d2$q <- "Close Non-Essential Businesses"

d3 <- dat %>% filter(vote_pre=="Trump" & !is.na(punished) & who_you_pre=="Agree" & who_you_post=="Agree") %>% group_by(punished,learned_who)%>% summarise(value=n()) %>% ungroup() %>% group_by(learned_who) %>% mutate(percent=100*value/sum(value))
d3$q <- "WHO Membership"

d1<-rename(d1,learned=learned_masks);d2<-rename(d2,learned=learned_closebusiness);d3<-rename(d3,learned=learned_who)
d<-bind_rows(d1,d2,d3)

d$punished <- factor(d$punished,levels=c('Punished','Did not punish','Missing Candidate Ratings'))
d <- d %>% group_by(learned,q) %>% mutate(y=percent+3) 
d$percent_label <- str_c(round(d$percent),"%")
d <- d %>% filter(punished=="Punished")
d$q <- factor(d$q,levels=c("Mandatory Masks in Public", "Close Non-Essential Businesses", 
"WHO Membership"))
ggplot(d,aes(x=learned,y=percent)) + 
 geom_bar(stat="identity") +
 facet_wrap(vars(q), nrow = 1)+xlab("") + ylab("Percent") + 
 theme(legend.position = "bottom",legend.margin=margin(c(1,1,1,1))) + geom_text(mapping=aes(learned,y,label=percent_label),colour="black",size=3) 

```

## Scale Reliabilities
```{r policy-alpha,cache=TRUE,caption="Policy Scale Reliabilities"}
tab <- tribble(~"Scale",~"Pre election alpha",~"Post-election alpha",
              "Attitudes towards Blacks",0.80,0.85,
               "Redistribution",0.77,0.82,
                "Abortion",0.80,0.83,
                "The Environment",0.83,0.88,
  "Immigration",0.78,0.84,
  "Health Care",0.60,0.71,
  "Covid-19 Policy",0.84,0.86)
  
tab %>% kable(caption="Policy Scale Reliabilities",booktabs=T) %>% kable_styling(font_size = 7,latex_options = "HOLD_position")
```

## Who Were the Learners and Who Shifted away from Trump?  {#who-learned-punished}

In this section, we seek to determine what kinds of voters learned and abandoned Trump. We consider several plausible correlates of learning and shifting away from Trump. First, having a stronger party identification may increase voters' likelihood of staying with the same party regardless of what happens and of rationalizing that choice. We therefore include the most complete measure of party identification intensity, the partisanship as a social identification scale developed by Huddy and Bankert (2017), which is an additive scale of eight partisanship items (see Table \@ref(tab:pid-social) for a list). Respondents with higher political knowledge may also be more likely to learn or punish their candidate. We thus also include the mean (across issues) level of knowledge of the candidates' positions. Another plausible correlate of learning and abandoning Trump is being personally affected by the coronavirus. We thus include a dummy variable identifying respondents who had had a positive Covid test, either them personally or a close friend or family member as well as another for those with a close friend or family member who died from the virus. 

To identify voters who learned and who abandoned Trump, we regress dummy variables indicating learning (as opposed to not changing candidate placements or projecting) and shifting away from Trump using linear probability models on the partisanship as a social identity scale, an overall candidate position knowledge scale, two measures of importance (coronavirus death among close friends and family, positive coronavirus test for self or close friends and family), and basic demographics. Table \@ref(tab:wholearnedpunished) shows the results. 

```{r wholearnedpunished,echo=FALSE,cache=T,results='asis',message=FALSE,warning=FALSE}
# Recode race so white is reference 
levels(dat$race_pre) <- c("Other","Black","White","Asian")
dat$race_pre <- factor(dat$race_pre,levels=c("White","Asian","Black","Other"))
mod1 <- lm(ifelse(learned_masks=="Learned",1,0) ~ pidsoc_rep_pre + candcorrect_pre + coronavirus_died_pre + coronavirus_test_pre + age_pre + gender_pre + race_pre + hispanic_pre + education_pre + hhi_pre + unemployed_pre,data=subset(dat,vote_pre=="Trump" & maskspublic_you_pre=="Agree"))
mod2 <- lm(ifelse(learned_closebusiness=="Learned",1,0) ~ pidsoc_rep_pre + candcorrect_pre + coronavirus_died_pre + coronavirus_test_pre + age_pre + gender_pre + race_pre + hispanic_pre + education_pre + hhi_pre + unemployed_pre,data=subset(dat,vote_pre=="Trump" & closebusiness_you_pre=="Agree"))
mod3 <- lm(ifelse(learned_who=="Learned",1,0) ~ pidsoc_rep_pre + candcorrect_pre + coronavirus_died_pre + coronavirus_test_pre + age_pre + gender_pre + race_pre + hispanic_pre + education_pre + hhi_pre + unemployed_pre,data=subset(dat,vote_pre=="Trump" & who_you_pre=="Agree"))
mod4 <- lm(ifelse(vote_post_tot!="Trump",1,0) ~ pidsoc_rep_pre + candcorrect_pre + coronavirus_died_pre + coronavirus_test_pre + age_pre + gender_pre + race_pre + hispanic_pre + education_pre + hhi_pre + unemployed_pre,data=subset(dat,vote_pre=="Trump" & (maskspublic_you_pre=="Agree" | closebusiness_you_pre=="Agree" | who_you_pre=="Agree")))
mod5 <- lm(ifelse(punished=="Punished",1,0) ~ pidsoc_rep_pre + candcorrect_pre + coronavirus_died_pre + coronavirus_test_pre + age_pre + gender_pre + race_pre + hispanic_pre + education_pre + hhi_pre + unemployed_pre,data=subset(dat,vote_pre=="Trump" & (maskspublic_you_pre=="Agree" | closebusiness_you_pre=="Agree" | who_you_pre=="Agree")))

stargazer(mod1,mod2,mod3,mod4,mod5,label="tab:wholearnedpunished",dep.var.labels=c("Learned Masks","Learned Businesses","Learned WHO","Shifted Vote","Shifted Away Ratings"),covariate.labels=c("PID Social Identity Scale","Candidate Position Knowledge","Coronavirus Death","Coronavirus Test","Age","Male","Asian","Black","Other","Hispanic","College Education","Graduate Education","Household Income","Unemployed","Intercept"),font.size = "scriptsize",digits=2,column.sep.width = "-5pt",header=F,title="Regression models for learning about Covid stances and shifting away from Trump", notes.label = "",notes="\\parbox[t]{\\textwidth}{Notes: These are OLS models with dummy variables for learning and shifting away from Trump (using both vote choice and changes in candidate ratings) regressed on partisan attachment, two variables for being personally affected by Covid, knowledge of the candidates' positions, and demographics.}",notes.align="l",df=F,omit.stat="f")

```

## Partisanship as a Social Identity Questions
```{r pid-social,cache=TRUE}
tab <- tribble(~Statement,
"I am interested in what other people think about this party.", 
"When people criticize this party, it feels like a personal insult.", 
"I have a lot in common with other supporters of this party.", 
"If this party does badly in opinion polls, my day is ruined.", 
"When I meet someone who supports this party, I feel connected with this person.", 
'When I speak about this party, I refer to them as "my party."', 
"When people praise this party, it makes me feel good.")
tab %>% kable(caption="Partisanship as a social identity questions. These statements are from Huddy and Bankert 2017. For these questions, respondents were asked about their agrement with each statement with respect to their party.",booktabs = T) %>% kable_styling(font_size = 7,latex_options = "HOLD_position")

```
 


